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

using namespace std;

#define FOR(i, s, e) for(int i = (s); i < (e); i++)

#define FOE(i, s, e) for(int i = (s); i <= (e); i++)

#define FOD(i, s, e) for(int i = (s); i >= (e); i--)

#define ll long long



ll A[100005], prime[10005], prime_3[10005];

int n, m, x, y, z, k, w;

int p[10005];



map<ll, int> M;



void find_prime()

{

	FOE(i, 2, 10000)

	{

		if (p[i] == 1) continue;

		for (int j = i * i; j <= 10000; j += i) p[j] = 1;

	}

	

	FOE(i, 2, 10000) if (p[i] == 0) 

	{

		prime[k] = i;

		prime_3[k++] = 1ll * i * i * i;

	}

}



ll inv(ll x)

{

	ll tmp = x, ret = 1ll;

	

	FOR(i, 0, k)

	{

		if (prime_3[i] > tmp) break;

		y = 0;

		while (tmp % prime[i] == 0) 

		{

			tmp /= prime[i];

			y++;

		}

		

		if (y == 1) ret *= prime[i] * prime[i];

		else if (y == 2) ret *= prime[i];

	

		if (ret > 10000000000ll) return -1;

	}

	

	ll t = (ll)sqrt(tmp);

	if (t * t == tmp) ret *= t;

	else ret *= tmp * tmp;

	

	if (ret > 10000000000ll) return -1;

	return ret;

}



int main ()

{

	find_prime();



	scanf("%d", &n);

	FOR(i, 0, n) 

	{

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

		FOR(j, 0, k) while (A[i] % prime_3[j] == 0) A[i] /= prime_3[j];

	}

	

	sort(A, A + n);



	x = 0;

	FOR(i, 0, n) 

	{

		x++;

		if (i == n - 1 || A[i] != A[i + 1])

		{

			M.insert(make_pair(A[i], x));

			x = 0;

		}

	}

	

	//FOR(i, 0, n) printf("%lld ", A[i]); printf("\n");

	

	int ans = 0;

	ll tmp;

	

	FOR(i, 0, n)

	{

		if (A[i] == 1) continue;

		if (i > 0 && A[i] == A[i - 1]) continue;

		

	//	printf("%d %d\n", A[i], M.find(A[i]) -> second);

		

		tmp = inv(A[i]);

		

		if (M.find(tmp) == M.end()) ans += M.find(A[i]) -> second;

		else 

		{

			if (tmp < A[i]) continue;

			ans += max(M.find(A[i]) -> second, M.find(tmp) -> second);

		}

	} 

	

	

	if (A[0] == 1) ans++;

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

}


// Faster C++ solution for the same problem (measured speedup: 1.1199200912938327x):
#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;

}