#include<cmath>
#include<map>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline ll in()
{
	ll k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
using std::map;
map<ll,ll>cx,dr;
map<ll,ll>::iterator it;
void sq_get(ll &a,ll &b,ll c)
{
	ll res=1,ret=1;
	for(ll i=2;i*i*i<=c;++i)
		if(c%i==0)
		{
			int t=0;
			while(c&&c%i==0)c/=i,++t;t%=3;
			if(!t)continue;
			res*=(t==1?i:i*i),ret*=(t==1?i*i:i);
		}
	if(c>1)
	{
		ll t=sqrt(c);
		if(t*t==c)
		{
			res*=c,ret*=t;
		}
		else
		{
			res*=c,ret*=c*c;
		}
	}
	a=res,b=ret;
}
int main()
{
	int n=in();ll a,b;
	for(int i=1;i<=n;++i)
	{
		sq_get(a,b,in());
		dr[a]=b;
		if(cx.find(a)!=cx.end())++cx[a];
		else cx[a]=1;
//		printf("%lld %lld\n",a,b);
	}
	int ans=0;
	for(it=cx.begin();it!=cx.end();++it)
		if((*it).second)
		{
			a=(*it).first;b=dr[a];
			if(a==1){++ans;continue;}
			if(cx.find(b)==cx.end()){ans+=cx[a];continue;}
			ans+=std::max(cx[a],cx[b]);
			cx[a]=cx[b]=0;
		}
	printf("%d\n",ans);
	return 0;
}
