Problem:
Score : 1100 points

Problem Statement

Snuke got positive integers s_1,...,s_N from his mother, as a birthday present. There may be duplicate elements.

He will circle some of these N integers. Since he dislikes cubic numbers, he wants to ensure that if both s_i and s_j (i ≠ j) are circled, the product s_is_j is not cubic. For example, when s_1=1,s_2=1,s_3=2,s_4=4, it is not possible to circle both s_1 and s_2 at the same time. It is not possible to circle both s_3 and s_4 at the same time, either.

Find the maximum number of integers that Snuke can circle.

Constraints

1 ≦ N ≦ 10^5

1 ≦ s_i ≦ 10^{10}

All input values are integers.

Input

The input is given from Standard Input in the following format:

N
s_1
:
s_N

Output

Print the maximum number of integers that Snuke can circle.

Sample Input 1

8
1
2
3
4
5
6
7
8

Sample Output 1

6

Snuke can circle 1,2,3,5,6,7.

Sample Input 2

6
2
4
8
16
32
64

Sample Output 2

3

Sample Input 3

10
1
10
100
1000000007
10000000000
1000000009
999999999
999
999
999

Sample Output 3

9

Solution in Ruby (2.3.3) (judge verdict: Wrong Answer)

require "prime"

a = gets.chomp.to_i#chomp.split(" ").map(&:to_i)
b = []
hsh = Hash.new{|k,v| k[v]=0}
hsh2 = {}#Hash.new{|k,v| k[v]=nil}
hsh2[1]=1
ans = 0
a.times do
  t = gets.chomp.to_i
  nwk = hsh2[t]
  if nwk
  nwk2 = nwk[1]
  nwk = nwk[0]
  else
  k = t.prime_division.map{|t| [t[0], t[1] % 3]}.select{|t| t[1] != 0}
  nwk= Prime.int_from_prime_division(k)
  nk = k.map{|t| [t[0], 3 - t[1]]}#.select{|t| t != []}#.flatten
  nwk2= Prime.int_from_prime_division(nk)
  hsh2[t] = [nwk, nwk2]
  end
  if nwk == 1
    hsh[1] += 1
  elsif hsh[nwk] > 0
    hsh[nwk] -= 1
    ans += 1
  else
    hsh[nwk2]+=1
  end
end
p a-ans- (hsh[1] - 1)