// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define FOR(i, s, e) for(int i = (s); i < (e); i++)

#define FOE(i, s, e) for(int i = (s); i <= (e); i++)

#define FOD(i, s, e) for(int i = (s); i >= (e); i--)

#define ll long long



ll A[100005], prime[10005], prime_3[10005];

int n, m, x, y, z, k, w;

int p[10005];



map<ll, int> M;



void find_prime()

{

	FOE(i, 2, 10000)

	{

		if (p[i] == 1) continue;

		for (int j = i * i; j <= 10000; j += i) p[j] = 1;

	}

	

	FOE(i, 2, 10000) if (p[i] == 0) 

	{

		prime[k] = i;

		prime_3[k++] = 1ll * i * i * i;

	}

}



ll inv(ll x)

{

	ll tmp = x, ret = 1ll;

	

	FOR(i, 0, k)

	{

		if (prime_3[i] > tmp) break;

		y = 0;

		while (tmp % prime[i] == 0) 

		{

			tmp /= prime[i];

			y++;

		}

		

		if (y == 1) ret *= prime[i] * prime[i];

		else if (y == 2) ret *= prime[i];

	

		if (ret > 10000000000ll) return -1;

	}

	

	ll t = (ll)sqrt(tmp);

	if (t * t == tmp) ret *= t;

	else ret *= tmp * tmp;

	

	if (ret > 10000000000ll) return -1;

	return ret;

}



int main ()

{

	find_prime();



	scanf("%d", &n);

	FOR(i, 0, n) 

	{

		scanf("%lld", &A[i]);

		FOR(j, 0, k) while (A[i] % prime_3[j] == 0) A[i] /= prime_3[j];

	}

	

	sort(A, A + n);



	x = 0;

	FOR(i, 0, n) 

	{

		x++;

		if (i == n - 1 || A[i] != A[i + 1])

		{

			M.insert(make_pair(A[i], x));

			x = 0;

		}

	}

	

	//FOR(i, 0, n) printf("%lld ", A[i]); printf("\n");

	

	int ans = 0;

	ll tmp;

	

	FOR(i, 0, n)

	{

		if (A[i] == 1) continue;

		if (i > 0 && A[i] == A[i - 1]) continue;

		

	//	printf("%d %d\n", A[i], M.find(A[i]) -> second);

		

		tmp = inv(A[i]);

		

		if (M.find(tmp) == M.end()) ans += M.find(A[i]) -> second;

		else 

		{

			if (tmp < A[i]) continue;

			ans += max(M.find(A[i]) -> second, M.find(tmp) -> second);

		}

	} 

	

	

	if (A[0] == 1) ans++;

	printf("%d\n", ans);

}


// Faster C++ solution for the same problem (measured speedup: 1.1377862297174834x):
#include<bits/stdc++.h>

#define debug puts("&&&&&&&&")

#define read(x) scanf("%lld",&x)

using namespace std;

typedef long long LL;

const int maxn=1e6+5;

const int maxx=1e10+2;

LL a[maxn];

LL b[maxn];

LL n;

map<LL,int>ma;

LL sqr(LL a) {

    return a*a;

}

int main() {

    while(cin>>n) {

        ma.clear();

        for(LL i=1;i<=n;i++) {

            LL t;

            cin>>t;

            for(LL j=2;j*j*j<=t;j++) {

                while(t%(j*j*j)==0) {

                    t/=(j*j*j);

                }

            }

            ma[t]++;a[i]=t;

            LL ans=1;

            for(LL j=2;j*j*j<=t;j++) {

                if(t%j==0) {

                    if(t%(j*j)==0) {

                        ans*=j;

                    }

                    else {

                        ans*=(j*j);

                    }

                }

                 while(t%j==0) {

                        t/=j;

                }

            }

            if (sqr((LL)sqrt(t))==t) ans*=(LL)sqrt(t);

            else ans*=t*t;

            b[i]=ans;

        }

        LL ans1=0;

        if(ma[1]){

            ans1++;

            ma[1]=0;}

        for(int i=1;i<=n;i++) {

            ans1+=max(ma[a[i]],ma[b[i]]);

            ma[a[i]]=ma[b[i]]=0;

        }

        cout<<ans1<<endl;

    }

    return 0;

}