// Slower C++ solution:
#include <bits/stdc++.h>

#define mst(a,b) memset(a,b,sizeof(a))

#define lowbit(x) ((x)&(-x))

#define X first

#define Y second

using namespace std;

typedef long long LL;

typedef long long ll;

typedef unsigned long long ull;

typedef pair<int, int> pii;

typedef pair<ll, ll> pll;

//const int mod = 1e9+7;

const int inf = 0x3f3f3f3f;

const ll INF = 0x3f3f3f3f3f3f3f3f;

const int maxn = 100000+10;

const double eps = 1e-9;

//const int maxm = 2510000+10;

bool is_prime[maxn];

int prime[maxn],id[maxn],tot;

ull seed=131;

ull f[maxn];

map<ull,int> cnt;

pair<ull,ull> a[maxn];

void init(){

    is_prime[1]=true;

    f[0]=1;

    for (int i=2;i*i<=100000;i++)

        if (!is_prime[i])

            for (int j=i*i;j<=100000;j+=i) is_prime[j]=true;

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

        if (!is_prime[i]) {

            prime[tot]=i;

            id[i]=tot++;

        } else id[i]=-1;

        f[i]=f[i-1]*seed;

    }

}

int main() {

#ifdef local

    freopen("in.txt", "r", stdin);

//    freopen("out.txt", "w", stdout);

#endif

    ios::sync_with_stdio(0);

    cin.tie(0);cout.tie(0);

    init();

    int n; cin>>n;

    int ans=0;

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

        ll x; cin>>x;

        ull H=0,P=0;

        for (int j=0;j<350 && 1ll*prime[j]*prime[j]<=x;j++){

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

                int c=0;

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

                    c=(c+1)%3;

                    x/=prime[j];

                }

                H+=f[id[prime[j]]]*c;

                P+=f[id[prime[j]]]*((3-c)%3);

            }

        }

        if (x>1){

            if (x<=100000 && !is_prime[x]){

                H+=f[id[x]];

                P+=f[id[x]]*2;

            } else if (x>100000) {

                ll tmp=sqrt(x)+eps;

                if (tmp*tmp==x && !is_prime[tmp]){

                    H+=f[id[tmp]]*2;

                    P+=f[id[tmp]];

                } else {

                    ans++;

                    continue;

                }

            }

        }

        a[i].X=H; a[i].Y=P;

        cnt[H]++;

    }

    if (cnt.count(0)) {

        ans++;

        cnt[0]=0;

    }

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

        ull H=a[i].X,P=a[i].Y;

        ans+=max(cnt[H],cnt[P]);

        cnt[H]=0; cnt[P]=0;

    }

    cout<<ans<<"\n";

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.463282768568902x):
#include <bits/stdc++.h>

#define x first

#define y second

using namespace std;



using i64 = long long;

using f64 = double;

using pll = pair<i64, i64>;

using pii = pair<int, int>;

using ptx = pair<f64, f64>;



map<i64, i64> cmp, cnt;

vector<i64> v, primes;

int n;



static void get_primes() {

    const int LIM = 100000;

    bitset<LIM> s = 0;



    for (int i = 2; i * i < LIM; ++i) {

        if (s[i])

            continue;

        for (int j = i * i; j < LIM; j+= i)

            s[j] = 1;

    }

    for (int i = 2; i < LIM; ++i)

        if (!s[i])

            primes.push_back(i);

}



static i64 get_complement(i64 num) {

    i64 c = 1;

    for (auto p: primes) {

        if (p * p > num) {

            c*= num * num;

            break;

        }

        if (num % (p * p) == 0) {

            c*= p;

            num/= p * p;

        }

        else if (num % p == 0) {

            c*= p * p;

            num/= p;

        }

    }

    return c;

}



int main() {

#ifdef HOME

    freopen("agc003d.in", "r", stdin);

    freopen("agc003d.out", "w", stdout);

#endif

    ios::sync_with_stdio(false);

    cin.tie(0), cout.tie(0);

    get_primes();



    cin >> n;

    v.resize(n);

    for (auto &i: v) {

        cin >> i;

        for (auto p: primes) {

            if (p * p * p > i)

                break;

            while (i % (p * p * p) == 0)

                i/= p * p * p;

        }

        cnt[i]++;

        if (cmp[i] == 0) {

            i64 t = get_complement(i);

            cmp[i] = t;

            cmp[t] = i;

        }

    }



    int ans = 0;

    for (auto i: v) {

        if (i == 1) {

            ans+= min(cnt[i], 1LL);

            cnt[i] = 0;

        }

        else {

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

            cnt[i] = cnt[cmp[i]] = 0;

        }

    }



    cout << ans << endl;



    return 0;

}