// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<cmath>

#include<map>

#include<algorithm>

using namespace std;

const long long MAXN=100005,MAXP=21000;



long long prime[MAXP],pcnt;

bool npr[MAXP];



void LinerSieve()

{

	npr[1]=true;

	for(long long i=2;i<MAXP;i++)

	{

		if(!npr[i])

			prime[++pcnt]=i;

		for(long long j=1;j<=pcnt&&prime[j]*i<MAXP;j++)

		{

			npr[prime[j]*i]=true;

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

				break;

		}

	}

}

long long ans;

map<long long,long long> cnt;

long long n,A[MAXN];

long long F(long long x)

{

	long long res=1;

	for(long long j=1;j<=pcnt&&prime[j]*prime[j]*prime[j]<=x;j++)

		if(x%prime[j]==0)

		{

			long long cnt=0;

			while(x%prime[j]==0)

				x/=prime[j],cnt++;

			cnt%=3;

			for(long long k=1;k<=cnt;k++)

				res*=prime[j];

		}

	if(x!=1)

		res*=x;

	return res;

}



int main()

{



	LinerSieve();

    scanf("%lld",&n);

    for(long long i=1;i<=n;i++)

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

	for(long long i=1;i<=n;i++)

	{

		A[i]=F(A[i]);

		cnt[A[i]]++;

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

	}

	

	bool flag=false;

	for(long long i=1;i<=n;i++)

	{

		if(A[i]==1)

			flag=true;

		else if(cnt[A[i]])

		{

			long long tmp=floor(sqrt(A[i])+0.5);

			long long y;

			if(tmp*tmp==A[i])

				y=tmp;

			else

				y=A[i]*A[i];

			y=F(y);

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

			if(cnt.count(y))

			{

				//puts("1");

				ans+=max(cnt[y],cnt[A[i]]);

				cnt[y]=cnt[A[i]]=0;

			}

			else

			{

				ans+=cnt[A[i]];

				cnt[A[i]]=0;

			}

		}

	}

	if(flag)

		ans++;

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



    fclose(stdin);

    fclose(stdout);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.241393079902504x):
#include<map>

#include<cstdio>

#include<algorithm>

using namespace std;

typedef long long ll;

const int MAX = 2160;

const int MAXN = 100000;

int prm[MAX + 5], pcnt = 0;

bool is_prm[MAX + 5];

void init() {

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

		if( !is_prm[i] )

			prm[++pcnt] = i;

		for(int j=1;i*prm[j]<=MAX;j++) {

			is_prm[i*prm[j]] = true;

			if( i % prm[j] == 0 ) break;

		}

	}

}

ll s[MAXN + 5], a[MAXN + 5], b[MAXN + 5];

ll IsSqr(ll x) {

	ll le = 1, ri = 100000;

	while( le < ri ) {

		ll mid = (le + ri) >> 1;

		if( mid * mid >= x ) ri = mid;

		else le = mid + 1;

	}

	return (ri * ri == x) ? ri : 0;

}

int siz[2*MAXN + 5];

map<ll, int>mp;

int main() {

	init(); int N;

	scanf("%d", &N);

	int ans = 0, flag = false;

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

		a[i] = b[i] = 1;

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

		for(int j=1;j<=pcnt;j++) {

			int cnt = 0;

			while( s[i] % prm[j] == 0 ) {

				cnt++;

				s[i] /= prm[j];

			}

			cnt %= 3;

			if( cnt == 1 ) {

				a[i] *= prm[j];

				b[i] *= prm[j] * prm[j];

			}

			else if( cnt == 2 ) {

				a[i] *= prm[j] * prm[j];

				b[i] *= prm[j];

			}

		}

		if( IsSqr(s[i]) ) {

			a[i] *= s[i];

			b[i] *= IsSqr(s[i]);

		}

		else {

			a[i] *= s[i];

			b[i] *= s[i] * s[i];

		}

		if( !flag && a[i] == 1 && b[i] == 1 )

			flag = true;

	}

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

		if( a[i] == 1 && b[i] == 1 ) continue;

		if( mp.count(a[i]) )

			siz[mp[a[i]]]++;

		else {

			mp[a[i]] = i;

			mp[b[i]] = i+N;

			siz[i]++;

		}

	}

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

		if( mp[a[i]] == i )

			ans += max(siz[i], siz[i+N]);

	}

	if( flag ) ans++;

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

}