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

using namespace std;

const int N = 100010;

typedef long long LL;

int n, pri_cnt = 0;

LL a[N], p1[N], p2[N], pri[N];

void pre_pri() {

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

        if (pri[i]) continue;

        pri[++pri_cnt] = i;

        for (int j = i + i; j < N; j += i) pri[i] = 1;

    }

}

void cal(LL x, int id) {

    p1[id] = p2[id] = 1;

    for (int i = 1; pri[i] * pri[i] * pri[i] <= x; i++) {

        int t = 0;

        while (x % pri[i] == 0) x /= pri[i], t++;

        t %= 3;

        for (int j = 0; j < t; j++) p1[id] *= pri[i];

        t = (3 - t) % 3;

        for (int j = 0; j < t; j++) p2[id] *= pri[i];

    }

    if (x) {

        LL t = sqrt(x);

        if (t * t == x)

            p1[id] *= x, p2[id] *= t;

        else

            p1[id] *= x, p2[id] *= x * x;

    }

}

map<LL, int> mp;

int main() {

    pre_pri();

    scanf("%d", &n);

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

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

        cal(a[i], i);

    }

    int ans = 0;

    for (int i = 1; i <= n; i++) mp[p1[i]]++;

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

    	if (mp[p1[i]] == 0) continue;

        if (p1[i] == p2[i]) {

            ans++;

            mp[p1[i]] = 0;

            continue;

        }

        ans += max(mp[p1[i]], mp[p2[i]]);

        mp[p1[i]] = mp[p2[i]] = 0;

    }

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

    return 0;

}

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

#include <ext/pb_ds/hash_policy.hpp>

#include <ext/pb_ds/assoc_container.hpp>

#include <iostream>

#include <algorithm>

#include <vector>

#include <queue>

#include <stack>

#include <set>

#include <map>

#include <cstring>

#include <cmath>



#define X first

#define Y second

#define ls rt<<1

#define rs rt<<1|1

#define getmid ((l+r)>>1)

#define PB push_back

#define EP emplace_back

#define MP make_pair

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

#define ALL(x) x.begin(),x.end()

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

#define rep(i,n) for(int i=0; i<(n); i++)

#define rep1(i,n) for(int i=1; i<=(n); i++)

#ifdef LOCAL

    #define dbg(a) cout << #a": " << a << endl;

#else

    #define dbg(a)

#endif // LOCAL



using namespace std;

using namespace __gnu_pbds;

typedef long long ll;

const int inf = 0x3f3f3f3f;

const ll INF = 0x3f3f3f3f3f3f3f3fll;

typedef pair<int,int> pii;

typedef pair<double,double> pdd;



const int N = 2200 + 10;

const int M = 1e5 + 10;

const int mod = 998244353;

const double eps = 1e-10;

const double pi = acos(-1.0);



int n;

ll a[M];

int prime[N+1],tot;

vector<ll> ve;

gp_hash_table<ll,int> cnt;

gp_hash_table<ll,ll> mp;



void getPrime(){

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

        if(!prime[i]) prime[++tot] = i;

        for(int j=1; j<=tot && prime[j]<=N/i; j++){

            prime[i*prime[j]] = 1;

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

        }

    }

}



inline bool check(ll n){

    ll m = sqrt(n+0.5);

    return n==m*m;

}



int main()

{

#ifdef LOCAL

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

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

#endif // LOCAL

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);



    getPrime();

    cin>>n;

    for(int i=1; i<=n; i++) cin>>a[i];

    int ans = 0;

    bool one = false;

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

        ll t = a[i];

        ll x = 1, y = 1;

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

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

                int num = 0;

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

                    t /= prime[j];

                    num++;

                }

                num %= 3;

                for(int k=1; k<=num; k++) x *= prime[j];

                for(int k=(3-num)%3; k; k--) y *= prime[j];

            }

            if(t==1) break;

        }

        if(t!=1) {

            if(check(t)) {

                x *= t;

                y *= (int)sqrt(t+0.5);

            } else {

                if((double)t*t*y<=1e10) {

                    x *= t;

                    y *= t*t;

                } else {

                    ans++;

                    continue;

                }

            }

        }

        if(x==1) {

            if(!one) {

                one = true;

                ans++;

            }

            continue;

        }

        mp[x] = y;

        if(++cnt[x]==1) ve.PB(x);

    }

    for(ll val: ve) {

        if(!cnt[val]) continue;

        int x = cnt[val];

        int y = cnt[mp[val]];

        ans += max(x, y);

        cnt[mp[val]] = 0;

    }

    cout<<ans<<endl;



    return 0;

}