// 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.372852480702516x):
#include <bits/stdc++.h>

using namespace std;



#define visit fuckitwholefamily

#define ll long long

#define MAXN 100005

#define Int int



int n,ans;ll s[MAXN];

map <ll,int> tot;

map <ll,bool> vis;



template <typename T> inline void read (T &t){t = 0;char c = getchar();int f = 1;while (c < '0' || c > '9'){if (c == '-') f = -f;c = getchar();}while (c >= '0' && c <= '9'){t = (t << 3) + (t << 1) + c - '0';c = getchar();} t *= f;}

template <typename T,typename ... Args> inline void read (T &t,Args&... args){read (t);read (args...);}

template <typename T> inline void write (T x){if (x < 0){x = -x;putchar ('-');}if (x > 9) write (x / 10);putchar (x % 10 + '0');}



int cnt,prime[3405],visit[3405];



void Euler (int up){

	for (Int i = 2;i <= up;++ i){

		if (!visit[i]) prime[++ cnt] = i;

		for (Int j = 1;j <= cnt && i * prime[j] <= up;++ j){

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

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

		}

	}

}



signed main(){

	read (n);Euler (3400);

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

		read (s[i]);

		for (ll p = 2;p * p * p <= s[i];++ p) while (s[i] % (p * p * p) == 0) s[i] /= p * p * p; 

		if (s[i] != 1) tot[s[i]] ++;

		else ans = 1;

	}

	for (Int i = 1;i <= n;++ i) 

		if (vis[s[i]] || s[i] == 1) continue;

		else{

			ll now = s[i],nowto = 1;

			for (Int j = 1;1ll * prime[j] * prime[j] * prime[j] <= now;++ j){

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

					nowto *= (now % (prime[j] * prime[j]) == 0 ? prime[j] : prime[j] * prime[j]);

					while (now % prime[j] == 0) now /= prime[j];

				}

			}

			ll w = sqrt (now);

			if (w * w == now) nowto *= w;

			else nowto *= now * now;

			vis[s[i]] = vis[nowto] = 1,ans += max (tot[s[i]],tot[nowto]);

		}

	write (ans),putchar ('\n');

	return 0;

}