// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <cstring>

#include <cmath>

#include <cstdio>

#include <cstdlib>

#include <vector>

#include <string>

#include <map>



using namespace std;



#define int long long



long long MAX_PRIME = 5000;

vector<long long> primes;



typedef pair<vector<int>, int> Num;



vector<Num> nums;



void addNum(long long x)

{

	Num num = {vector<int>(0), 0};

    for (long long p : primes) {

        if (x % p) continue;

        int r = 0;

        while (x % p == 0) {

            x /= p;

            ++r;

        }

		r %= 3;

		if (r > 0) {

            num.first.push_back(p);

            num.second = num.second * 2 + (r - 1);

		}

    }



    int y = sqrt(x);

    if (x == 1) {

		nums.push_back(num);

		return;

    }

    if (y * y == x) {

		num.first.push_back(y);

        num.second = num.second * 2 + 1;

        nums.push_back(num);

    } else {

		num.first.push_back(x);

        num.second = num.second * 2;

        nums.push_back(num);

    }

}



void printNum(Num n)

{

    for (int ch : n.first) cerr << ch << ' ';

    cerr << "; " << n.second << endl;

}



signed main()

{

	// Initialize

	vector<bool> isPrime(MAX_PRIME + 1, 1);

	for (long long i = 2; i <= MAX_PRIME; ++i) {

		if (isPrime[i]) {

			primes.push_back(i);

			for (long long j = i + i; j <= MAX_PRIME; j+=i) {

                isPrime[j] = 0;

			}

		}

	}



    int n;

    cin >> n;

    nums.reserve(n);

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

        int x;

        cin >> x;

        addNum(x);

    }



    sort(nums.begin(), nums.end());



//    for (Num n : nums) printNum(n);

//    cerr << endl;;



    int ans = n;

    for (int i = 0; i < (int)nums.size(); ++i) {

		int si = i, ei = i;

        while (ei+1 < (int)nums.size() && nums[si].first == nums[ei+1].first) ++ei;

        i = ei;

        int bitsum = (1 << nums[si].first.size()) - 1;

//        cerr << si << ' ' << ei << endl;



		if (nums[si].first.size() == 0) {

			ans -= (ei - si);

			continue;

		}



        while (1) {

            while (si < ei && nums[si].second + nums[ei].second != bitsum) {

                if (nums[si].second + nums[ei].second < bitsum) ++si;

                else --ei;

            }

            if (si >= ei) break;



            int lc = 1, rc = 1;

            while (nums[si].second == nums[si+1].second) {

				++si;

				++lc;

            }

            while (nums[ei].second == nums[ei-1].second) {

				--ei;

				++rc;

            }



            ans -= min(lc, rc);



            ++si; --ei;

        }

    }

	cout << ans << endl;

}


// Faster C++ solution for the same problem (measured speedup: 1.12314079882756x):
#include<cstdio>

#include<map>

#include<cmath>

#include<algorithm>

#define MAXN 3006

#define MAXM 100006

#define INF 210000000000

using namespace std;

long long vis[MAXN],prime[MAXN],cnt,n,sum;

long long B,C,ans,last,a;

void waiting()

{

	for(long long i=2;i<MAXN;i++)

	{

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

		for(long long j=1;prime[j]*i<MAXN;j++)

		{

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

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

		}

	}

}

struct node

{

	long long b,c;

}p[MAXM];

bool cmp(node a,node b)

{

	return a.b<b.b;

}

map<long long,long long> ma,gg;

int main()

{

	//freopen("anticube.in","r",stdin);

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

	waiting();

	scanf("%lld",&n);

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

	{

		scanf("%lld",&a);

		B=1;

		C=1;

		for(long long j=1;j<=cnt;j++)

		{

			sum=0;

			if(a==1) break;

			while(a%prime[j]==0)

			{

				a/=prime[j];

				sum++;

			}

			sum%=3;

			if(sum)

			{

				if(sum==1)

				{

					B*=prime[j];

					C=C*prime[j];

					C=C*prime[j];

				}

				else

				{

					C*=prime[j];

					B=B*prime[j]*prime[j];

				}

			}

		}

		if(a!=1)

		{

			long long chuizi=sqrt(a);

			if(a==chuizi*chuizi)

			{

				B*=chuizi*chuizi;

				C*=chuizi;

			}

			else

			{

				B*=a;

				C*=a*a;

			}

		}

		p[i].b=B;

		p[i].c=C;

	}

	/*for(long long i=1;i<=n;i++)

		printf("%lld ",p[i].b);

	printf("\n");

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

		printf("%lld ",p[i].c);*/

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

		ma[p[i].b]++;

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

	{

		if(gg[p[i].b]) continue;

		gg[p[i].b]=1;

		if(p[i].c==p[i].b) ans++;

		else

		{

			ans+=max(ma[p[i].b],ma[p[i].c]);

			gg[p[i].c]=1;

		}

	}

	printf("%lld",ans);

}