import
java.util.*;
class
GFG
{
static
void
printNumbers(
int
a[],
int
n)
{
Map<Integer,
Integer> mpp =
new
HashMap<>();
for
(
int
i =
0
; i < n; i++)
{
int
num = a[i];
for
(
int
j =
1
; j * j <= num; j++)
{
if
(num % j ==
0
)
{
if
(j !=
1
)
{
if
(mpp.containsKey(j))
{
mpp.put(j, mpp.get(j) +
1
);
}
else
{
mpp.put(j,
1
);
}
}
if
((num / j) != j)
{
if
(mpp.containsKey(num / j))
{
mpp.put(num / j, mpp.get(num / j) +
1
);
}
else
{
mpp.put(num / j,
1
);
}
}
}
}
}
int
maxi =
0
;
for
(Map.Entry<Integer,
Integer> it : mpp.entrySet())
{
maxi = Math.max(it.getValue(), maxi);
}
for
(Map.Entry<Integer,
Integer> it : mpp.entrySet())
{
if
(it.getValue() == maxi)
System.out.print(it.getKey() +
" "
);
}
}
public
static
void
main(String[] args)
{
int
a[] = {
12
,
15
,
27
,
20
,
40
};
int
n = a.length;
printNumbers(a, n);
}
}