#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;

	vector<long long> a(n);
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
	}

	vector<bool> is_prime(101010, true);
	vector<long long> ps;
	map<long long, long long> rt;

	for (long long i = 2; i < 101010; i++) {
		if (is_prime[i]) {
			ps.push_back(i);
			rt[i * i] = i;
			for (int j = i * 2; j < 101010; j += i) {
				is_prime[j] = false;
			}
		}
	}

	map<vector<long long>, vector<long long>> inv;
	map<vector<long long>, int> cnt;

	for (int i = 0; i < n; i++) {
		vector<long long> p, q;
		for (int j = 0; ps[j] <= 2500; j++) {
			int c = 0;
			while (a[i] % ps[j] == 0) a[i] /= ps[j], c++;
			c %= 3;
			if (c > 0) {
				for (int i = 0; i < c; i++) p.push_back(ps[j]);
				for (int i = 0; i < 3 - c; i++) q.push_back(ps[j]);
			}
		}
		if (a[i] != 1) {
			if (rt.count(a[i])) {
				p.push_back(rt[a[i]]);
				p.push_back(rt[a[i]]);
				q.push_back(rt[a[i]]);
			} else {
				p.push_back(a[i]);
				q.push_back(a[i]);
				q.push_back(a[i]);
			}
		}
		inv[p] = q;
		inv[q] = p;
		cnt[p]++;
	}

	int ans = 0;
	for (auto &kv : inv) {
		auto &x = kv.first;
		auto &y = kv.second;

		if (x == y) {
			ans++;
		} else if (x < y) {
			ans += max(cnt[x], cnt[y]);
		}
	}
	cout << ans << endl;
}