#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    typedef long long ll;
    #define pr pair<int,int>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    #define GG(x) if(x) {puts("error");exit(666);}
    #define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
    #define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    inline int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> inline void add(T &x,const T y){x=mm(x+y);}
    inline ll qpower(ll x,ll e)
    {
        ll ans=1;GG(e<0);
        while(e){if(e&1)ans=ans*x%MOD;x=x*x%MOD;e>>=1;}return ans;
    }
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=1e6+10;

    const int NUM=1e5+10;
    bool nop[NUM];int prn,prm[NUM],mip[N];
    void pre()
    {
        fo(i,2,NUM-1)
        {
            if(!nop[i]) prm[++prn]=i,mip[i]=i;
            for(int j=1;j<=prn and (ll)prm[j]*i<NUM;j++)
            {
                int t=prm[j]*i;nop[t]=1;mip[t]=prm[j];
                if(i%prm[j]==0) break;
            }
        }
    }
    map<ll,int> a,b;
    ll f[N],lg[N];
    void main()
    {
        pre();
        int n=qread();
        fo(i,1,n)
        {
            ll num=qread();
            for(int i=1;prm[i]<=2200;i++) {ll tmp=1ll*prm[i]*prm[i]*prm[i];while(num%tmp==0)num/=tmp;}
            a[num]++;
        }
        fo(i,2,N-1) lg[i]=lg[i>>1]+1;
        int ans=(a[1]>0);
        fo(i,2,1e5)
        {
            vc<int> tmp;
            int num=i;bool err=0;
            while(num>1) {
                int now=mip[num];tmp.PB(now);
                int ct=0;while(num%now==0)num/=now,ct++;
                if(ct>1) err=1;
            }if(err) continue;

            // if(i==50)
            //     puts("");

            int m=sz(tmp);
            f[0]=1;fo(t,0,m-1) f[0]*=tmp[t];
            fo(s,1,bin(m)-1)
            {
                int t=s&-s;f[s]=f[s^t]*tmp[lg[t]];
                if(s>((bin(m)-1)^s))
                {
                    if(a[f[s]] or a[f[(bin(m)-1)^s]])
                    {
                        // printf("i=%d f[%d]=%d f[%d]=%d\n",i,s,f[s],(bin(m)-1)^s,f[(bin(m)-1)^s]);
                        ans+=max(a[f[s]],a[f[(bin(m)-1)^s]]);
                        a[f[s]]=a[f[(bin(m)-1)^s]]=0;
                    }
                }
            }
        }
        for(map<ll,int>::iterator t=a.begin();t!=a.end();t++) if(t->FR!=1) ans+=t->SE;write(ans);
    }
};//(ans+MOD)%MOD
int main()
{
    srand(time(0));
    mine::main();
}


Measured memory_bytes: 42752