import
java.util.*;
class
GFG {
public
static
void
main(String[] args)
{
int
N =
5
;
int
[] A = {
27
,
8
,
12
,
16
,
12
};
int
res =
0
;
ArrayList<Integer> arr =
new
ArrayList<Integer>();
for
(
int
i =
0
; i < N; i++) {
if
(!isPerfectSquare(A[i]))
arr.add(A[i]);
}
HashMap<Integer, Integer> freq =
new
HashMap<>();
for
(
int
i =
0
; i < arr.size(); i++) {
HashMap<Integer, Integer> factors
= getPrimeFactorisation(arr.get(i));
int
prod =
1
;
for
(Map.Entry<Integer, Integer> factor :
factors.entrySet()) {
int
key = factor.getKey();
int
value = factor.getValue();
if
(value %
2
!=
0
) {
prod *= key;
}
}
if
(freq.containsKey(prod)) {
freq.put(prod, freq.get(prod) +
1
);
}
else
{
freq.put(prod,
1
);
}
}
for
(Map.Entry<Integer, Integer> f :
freq.entrySet()) {
res = Math.max(res, f.getValue());
}
System.out.println(res);
}
static
HashMap<Integer, Integer>
getPrimeFactorisation(
int
num)
{
HashMap<Integer, Integer> factors =
new
HashMap<>();
for
(
int
i =
2
; i * i <= num; i++) {
int
cnt =
0
;
while
(num % i ==
0
) {
num /= i;
cnt +=
1
;
}
factors.put(i, cnt);
}
if
(num >
1
)
factors.put(num,
1
);
return
factors;
}
static
boolean
isPerfectSquare(
int
x)
{
int
s = (
int
)Math.sqrt(x);
return
s * s == x;
}
}