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

#define ADD(a, b) a = (a + ll(b)) % mod

#define MUL(a, b) a = (a * ll(b)) % mod

#define MAX(a, b) a = max(a, b)

#define MIN(a, b) a = min(a, b)

#define rep(i, a, b) for(int i = int(a); i < int(b); i++)

#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

#define all(a) (a).begin(), (a).end()

#define sz(v) (int)(v).size()

#define pb push_back

#define sec second

#define fst first

#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

typedef pair<int, int> pi;

typedef pair<ll, ll> pl;

typedef pair<int, pi> ppi;

typedef vector<int> vi;

typedef vector<ll> vl;

typedef vector<vl> mat;

typedef complex<double> comp;

void Debug() {cout << '\n'; }

template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){

	cout<<arg<<" ";Debug(rest...);}

template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {

	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}

template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){

	out<<"("<<v.first<<", "<<v.second<<")";return out;}

const int MAX_N = 200010;

const int MAX_V = 100010;

const double eps = 1e-6;

const ll mod = 1000000007;

const int inf = 1 << 29;

const ll linf = 1LL << 60;

const double PI = 3.14159265358979323846;

///////////////////////////////////////////////////////////////////////////////////////////////////



const ll bound = 10000000000LL;



void update(pl& p, ll a, int cnt) {

	if(cnt == 1) {

		p.fst *= a;

		p.sec *= a * a;

	}

	else {

		p.fst *= a * a;

		p.sec *= a;

	}

}



bool ok(ll a, ll b) {

	int cnt = 0;

	while(a >= 10) {

		a /= 10; cnt++;

	}

	while(b >= 10) {

		b /= 10; cnt++;

	}

	return cnt <= 10;

}



pl ntn(ll a) {

	map<ll, int> res;

	for(ll i = 2; i <= 3000; i++) {

		while(a % i == 0) {

			res[-i]++;

			a /= i;

		}

	}

	ll sa = ll(sqrt(a) + eps);

	if(a != 1) {

		if(a == sa * sa) res[-sa] += 2;

		else res[-a]++;

	}

	// debug(vector<pl>(all(res)));



	pl pre1 = pl(1, 1);

	pl pre2 = pl(1, 1);

	bool fst = true;

	for(auto p : res) {

		p.sec %= 3;

		if(p.sec == 0) continue;

		ll v = -p.fst;

		if(fst) {

			update(pre1, v, p.sec);

			fst = false;

		}

		else update(pre2, v, p.sec);

	}

	// debug(pre1, pre2);

	if(ok(pre1.sec, pre2.sec)) {

		return pl(pre1.fst * pre2.fst, pre1.sec * pre2.sec);

	}

	else return pl(pre1.fst * pre2.fst, -1);

}



int N;

map<pl, int> G;



void solve() {

	cin >> N;

	rep(i, 0, N) {

		ll a; cin >> a;

		G[ntn(a)]++;

	}



	int cnt = 0;

	for(auto pp : G) {

		// debug(pp);

		pl pt = pp.fst;

		int v = pp.sec;

		if(pt == pl(1, 1)) cnt += 2;

		else if(pt.sec == -1) cnt += v * 2;

		else {

			swap(pt.fst, pt.sec);

			if(G.find(pt) != G.end()) {

				int w = G[pt];

				cnt += max(v, w);

			}

			else cnt += v * 2;

		}

	}

	cout << cnt / 2 << "\n";

}



int main() {

#ifndef LOCAL

	ios::sync_with_stdio(false);

    cin.tie(0);

#endif

    cout << fixed;

	cout.precision(20);

	srand((unsigned int)time(NULL));

#ifdef LOCAL

	//freopen("in.txt", "wt", stdout); //for tester

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

#endif	

	solve();

#ifdef LOCAL

    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

#endif

	return 0;

}




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

#define ADD(a, b) a = (a + ll(b)) % mod

#define MUL(a, b) a = (a * ll(b)) % mod

#define MAX(a, b) a = max(a, b)

#define MIN(a, b) a = min(a, b)

#define rep(i, a, b) for(int i = int(a); i < int(b); i++)

#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

#define all(a) (a).begin(), (a).end()

#define sz(v) (int)(v).size()

#define pb push_back

#define sec second

#define fst first

#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

typedef pair<int, int> pi;

typedef pair<ll, ll> pl;

typedef pair<int, pi> ppi;

typedef vector<int> vi;

typedef vector<ll> vl;

typedef vector<vl> mat;

typedef complex<double> comp;

void Debug() {cout << '\n'; }

template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){

	cout<<arg<<" ";Debug(rest...);}

template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {

	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}

template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){

	out<<"("<<v.first<<", "<<v.second<<")";return out;}

const int MAX_N = 200010;

const int MAX_V = 100010;

const double eps = 1e-6;

const ll mod = 1000000007;

const int inf = 1 << 29;

const ll linf = 1LL << 60;

const double PI = 3.14159265358979323846;

///////////////////////////////////////////////////////////////////////////////////////////////////



const ll bound = 10000000000LL;



void update(pl& p, ll a, int cnt) {

	if(cnt == 1) {

		p.fst *= a;

		p.sec *= a * a;

	}

	else {

		p.fst *= a * a;

		p.sec *= a;

	}

}



bool ok(ll a, ll b) {

	int cnt = 0;

	while(a >= 10) {

		a /= 10; cnt++;

	}

	while(b >= 10) {

		b /= 10; cnt++;

	}

	return cnt <= 10;

}



pl ntn(ll a) {

	map<ll, int> res;

	for(ll i = 2; i <= 400; i++) {

		while(a % i == 0) {

			res[-i]++;

			a /= i;

		}

	}

	ll sa = ll(sqrt(a) + eps);

	if(a != 1) {

		if(a == sa * sa) res[-sa] += 2;

		else res[-a]++;

	}

	// debug(vector<pl>(all(res)));



	pl pre1 = pl(1, 1);

	pl pre2 = pl(1, 1);

	bool fst = true;

	for(auto p : res) {

		p.sec %= 3;

		if(p.sec == 0) continue;

		ll v = -p.fst;

		if(fst) {

			update(pre1, v, p.sec);

			fst = false;

		}

		else update(pre2, v, p.sec);

	}

	// debug(pre1, pre2);

	if(ok(pre1.sec, pre2.sec)) {

		return pl(pre1.fst * pre2.fst, pre1.sec * pre2.sec);

	}

	else return pl(pre1.fst * pre2.fst, -1);

}



int N;

map<pl, int> G;



void solve() {

	cin >> N;

	rep(i, 0, N) {

		ll a; cin >> a;

		G[ntn(a)]++;

	}



	int cnt = 0;

	for(auto pp : G) {

		// debug(pp);

		pl pt = pp.fst;

		int v = pp.sec;

		if(pt == pl(1, 1)) cnt += 2;

		else if(pt.sec == -1) cnt += v * 2;

		else {

			swap(pt.fst, pt.sec);

			if(G.find(pt) != G.end()) {

				int w = G[pt];

				cnt += max(v, w);

			}

			else cnt += v * 2;

		}

	}

	cout << cnt / 2 << "\n";

}



int main() {

#ifndef LOCAL

	ios::sync_with_stdio(false);

    cin.tie(0);

#endif

    cout << fixed;

	cout.precision(20);

	srand((unsigned int)time(NULL));

#ifdef LOCAL

	//freopen("in.txt", "wt", stdout); //for tester

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

#endif	

	solve();

#ifdef LOCAL

    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

#endif

	return 0;

}