#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
__int128_t z = 1;
__int128_t nn;
#define F first
#define S second
const int MN = 1e6+100;
ll qwe[MN];
ll f(ll x) {
    __int128_t x2 = x;
    x2 = (x2*x2+z)%nn;
    x = x2;
    return x;
}
ll f2(ll n) {
    nn = n;
    z = 1;
    while(1) {
        ll y = 2%n;
        ll x = f(y);
        for(int i = 0; i < 4e3; ++i) {
            if(i&1) {
                x = f(x);
                y = f(y);
            }
            else {
                x = f(x);
            }
            ll qwe = (x-y + n)%n;
            ll q = __gcd(qwe, n);
            if(q != 1 && q != n) {
                return max(q, n/q);
            }
        }
//        cout<<"LOL"<<endl;
        z += 2;
    }
}
typedef __int128 lll;

lll powmod(lll a, lll p, lll mod) {
    if (p==0) return 1;
    if (p%2==0) {
        a=powmod(a, p/2, mod);
        return (a*a)%mod;
    }
    return (a*powmod(a, p-1, mod))%mod;
}

bool is_w(ll a, ll even, ll odd, ll p) {
    lll u = powmod(a, odd, p);
    if (u==1) return 0;
    for (ll j=1;j<even;j*=2) {
        if (u==p-1) return 0;
        u*=u;
        u%=p;
    }
    return 1;
}

bool isPrime(ll p) {
    if (p==2) return 1;
    if (p<=1||p%2==0) return 0;
    ll odd=p-1;
    ll even=1;
    while (odd%2==0) {
        even*=2;
        odd/=2;
    }
    ll b[7]={2, 325, 9375, 28178, 450775, 9780504, 1795265022};
    for (ll i=0;i<7;i++) {
        ll a=b[i]%p;
        if (a==0) return 1;
        if (is_w(a, even, odd, p)) return 0;
    }
    return 1;
}
vector<ll> f3(ll x) {
    vector<ll> res;
    //cout<<x<<endl;
    if(x >= MN) {
        if(isPrime(x)) {
            res.push_back(x);
            return res;
        }
        ll q = f2(x);
        res = f3(q);
        vector<ll> q2 = f3(x/q);
        res.insert(res.end(), q2.begin(), q2.end());
        return res;
    }
    while(x > 1) {
        res.push_back(qwe[x]);
        x /= qwe[x];
    }
    return res;
}

unordered_set<ll> neliot;
vector<pair<ll, ll> >  v4[MN];
unordered_map<ll, ll> um;
int main() {

    qwe[1] = 1;
    for(ll i = 2; i < MN; ++i) {
        if(!qwe[i]) {
            qwe[i] = i;
            for(ll j = i*i; j < MN; j += i) {
                qwe[j] = i;
            }
        }
    }

    int n;
    cin>>n;
    vector<ll> v(n);
    for(ll i = 1; i < 2e5; ++i) {
        neliot.insert(i*i*i);
    }
    for(int i = 0; i < n; ++i) {
        cin>>v[i];
        //v[i] = (1e9+7)*3;
        //v[i] = (ll)rand()*(rand()%5+1);
    }
    sort(v.begin(), v.end());
    ll nelioja = 0;
    ll yksi = 0;
    for(int i = (int)v.size()-1; i >= 0; --i) {
        if(neliot.count(v[i])) {
            ++nelioja;
            v[i] = v.back();
            v.pop_back();
        }
    }
    set<ll> lol;
    vector<pair<ll, ll> > zz;
    for(int i = 0; i < v.size(); ++i) {
    //    cout<<i<<endl;
        ll q = v[i];
        ll res = 1;
     //       cout<<"LOL "<<q<<endl;
        if(isPrime(q)) {
            v4[i].push_back({q, 1});
            res = q;
        }
        else {
            vector<ll> q2 = f3(q);
      //      cout<<"POis\n";
            sort(q2.begin(), q2.end());
          //  for(int x: q2) cout<<x<<' ';
          //  cout<<'\n';
            vector<pair<ll, ll> > q3;
            while(q2.size()) {
                if(q2.size() == 1) {
                    q3.push_back({q2.back(), 1});
                    q2.pop_back();

                }
                else if(q2.size() == 2) {
                    if(q2.back() == q2[q2.size()-2]) {
                        q3.push_back({q2.back(), 2});
                        q2.pop_back();
                        q2.pop_back();
                    }
                    else {
                        q3.push_back({q2.back(), 1});
                        q2.pop_back();
                    }
                }
                else{
                    if(q2.back() == q2[q2.size()-2] && q2[q2.size()-2] == q2[q2.size()-3]) {
                        q2.pop_back();
                        q2.pop_back();
                        q2.pop_back();
                    }
                    else if(q2.back() == q2[q2.size()-2]){
                        q3.push_back({q2.back(), 2});
                        q2.pop_back();
                        q2.pop_back();
                    }
                    else {
                        q3.push_back({q2.back(), 1});
                        q2.pop_back();
                    }
                }
            }
            v4[i] = q3;
            for(auto x: q3) for(int i = 0; i < x.S; ++i) res *= x.F;
        }
        ll res2 = 1;
        for(auto x: v4[i]) {
            ll q = x.S;
      //      cout<<q<<' ';
            if(q == 1) q = 2;
            else if(q == 2) q = 1;
            for(int i = 0; i < q; ++i) res2 *= x.F;
        }
     //   cout<<endl;
        um[res]++;
        zz.push_back({res, res2});
    }
    ll ans = 0;
    for(auto x: zz) {
//        cout<<x.F<<' '<<x.S<<' '<<um[x.F]<<' '<<um[x.S]<<endl;
        ll q = max(um[x.F], um[x.S]);
        ans += q;
        um[x.F] = 0;
        um[x.S] = 0;
    }
    cout<<ans+!!nelioja+yksi<<endl;
}


Measured memory_bytes: 57028