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 PyPy3 (2.4.0) (judge verdict: Time Limit Exceeded)

"""
Rを立法数とする
a * R と a**2 * R a**1 * R → a**2*R a**1*R a**2*R
3つはなれてるとあかん！！　でも取り除かれてるはずだよな…
→Rを取り除いて後はDP

どうやって立法数を取り除く？
10**3.3まで試し割り？→5secだから間に合うかなぁ


Rを取り除く→10**3.333333以下の素数の3乗で割れるか確かめる

対になるsの導出：
素因数分解→10**5まで試し割(割れて10**5以下になったらdivlis方式に変える)
→巨大素数ばっかりだと死ぬ
2乗して新たに生まれたRを取り除けばok！！！！
→範囲は？10**6.6666以下か？(やばくね？)

sと対になるsでは片方しか取れない(dicで管理するかぁ)
sと対sの中で小さい方に合わせてdicで管理かなぁ
"""
def Sieve(n): #n以下の素数全列挙(O(nloglogn)) retは素数が入ってる。divlisはその数字の素因数が一つ入ってる

    ret = []
    divlis = [-1] * (n+1) #何で割ったかのリスト(初期値は-1)
    
    flag = [True] * (n+1)
    flag[0] = False
    flag[1] = False

    ind = 2
    while ind <= n:

        if flag[ind]:
            ret.append(ind)

            ind2 = ind ** 2

            while ind2 <= n:
                flag[ind2] = False
                divlis[ind2] = ind
                ind2 += ind

        ind += 1

    return ret,divlis


N = int(input())
dic = {}

ret,divlis = Sieve(4641589)
div3 = 0

for loop in range(N):

    s = int(input())
    ndic = {}

    for i in ret:

        while s % i == 0:
            if i not in ndic:
                ndic[i] = 1
            else:
                ndic[i] += 1
            s //= i

        if s < len(divlis):
            break

    #print (s,"now",loop)

    while s < len(divlis) and divlis[s] != -1:
        if divlis[s] not in ndic:
            ndic[divlis[s]] = 1
        else:
            ndic[divlis[s]] += 1

        s //= divlis[s]

    if s != 1:
        if s not in ndic:
            ndic[s] = 1
        else:
            ndic[s] += 1

    S = 1
    T = 1
    #print (ndic)
    for i in ndic:
        S *= i ** (ndic[i] % 3)
        T *= i ** ((-1 * ndic[i]) % 3)

    #print (S,T)

    if S == T:
        div3 += 1
    elif S < T:
        if S not in dic:
            dic[S] = [1,0]
        else:
            dic[S][0] += 1
    else:
        if T not in dic:
            dic[T] = [0,1]
        else:
            dic[T][1] += 1

ans = min(1,div3)

for i in dic:
    ans += max(dic[i])

print (ans)