// 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.1943458652604908x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<cmath>

#include<map>

#define SF scanf

#define PF printf

#define MAXN 100010

#define MAXP 2300

using namespace std;

typedef long long ll;

int primes[MAXN],cnt;

int isprime[MAXP+100];

ll a[MAXN],les[MAXN],les1[MAXN];

map<ll,int> mp,st;

void prepare(){

	for(int i=2;i<=MAXP;i++){

		if(isprime[i]==0)

			primes[++cnt]=i;

		for(int j=1;i*primes[j]<=MAXP;j++){

			isprime[i*primes[j]]=1;

			if(i%primes[j]==0)

				break;	

		}

	}

}

int main(){

	prepare();

	//PF("%d",cnt);

	int n;

	SF("%d",&n);

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

		SF("%lld",&a[i]);

		les1[i]=les[i]=a[i];

	}

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

		ll p=primes[i];

		ll p2=p*p;

		ll p3=p*p*p;

		for(int j=1;j<=n;j++)

			if(a[j]%p==0){

				while(a[j]%p3==0){

					a[j]/=p3;

					les1[j]/=p3;

					les[j]/=p3;

				}

				if(les1[j]%p2==0){

					les1[j]/=p;

					les[j]/=p;

				}

				if(les[j]%p==0)

					les[j]/=p;

			}

	}

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

		if(les[i]==1){

			les[i]=les1[i];

			continue;

		}

		ll x=(long long)sqrt(les[i]);

		if(x*x==les[i])

			les[i]=les1[i]/x;

		else

			les[i]=les1[i];	

	}	

	int ans=0;

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

		if(a[i]==1){

			ans=1;

			continue;

		}

		mp[a[i]]++;

		st[a[i]]=les[i];

	}

	map<ll,int>::iterator it=mp.begin();

	for(;it!=mp.end();it++){

		ll x=it->first;

		int sum=it->second;

		ll y=st[x];

		ll xi=y*y/x*y;

		if(mp.count(xi)==0)

			ans+=sum;

		else{

			if(xi>x)

				ans+=max(sum,mp[xi]);	

		}

	}

	PF("%d",ans);

}