#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ii, ii> iii;
ll MOD = 1e9 + 7;
const ld E = 1e-7;
#define null NULL
#define ms(x) memset(x, 0, sizeof(x))
#ifndef LOCAL
#define endl "\n"
#endif
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define _read(x) freopen(x, "r", stdin)
#define _write(x) freopen(x, "w", stdout)
#define files(x) _read(x ".in"); _write(x ".out")
#define filesdatsol(x) _read(x ".DAT"); _write(x ".SOL")
#define output _write("output.txt")
#define input _read("input.txt")
#define mod % MOD
#define y1 hello_world
unsigned char ccc;
bool _minus = false;
template<typename T>
inline T sqr(T t) {
	return (t * t);
}
inline void read(ll &n) {
	n = 0;
	_minus = false;
	while (true) {
		ccc = getchar();
		if (ccc == ' ' || ccc == '\n')
			break;
		if (ccc == '-') {
			_minus = true;
			continue;
		}
		n = n * 10 + ccc - '0';
	}
	if (_minus)
		n *= -1;
}
inline void read(int &n) {
	n = 0;
	_minus = false;
	while (true) {
		ccc = getchar();
		if (ccc == ' ' || ccc == '\n')
			break;
		if (ccc == '-') {
			_minus = true;
			continue;
		}
		n = n * 10 + ccc - '0';
	}
	if (_minus)
		n *= -1;
}
char wwww[19];
int kkkk;
inline void write(ll y) {
	long long x = y;
	kkkk = 0;
	if (!x)
		++kkkk, wwww[kkkk] = '0';
	else
		while (x) {
			++kkkk;
			wwww[kkkk] = char(x % 10 + '0');
			x /= 10;
		}
	for (int i = kkkk; i >= 1; --i)
		putchar(wwww[i]);
	putchar('\n');
}

#ifdef LOCAL
//#define DEBUG
#endif

const int MAX = 4e3 + 1;
bool prime[MAX];
vector<int> primes;
int ans = 0;
int cubes = 0;
map<ll, ll> m1, m2;
const ll INF = 1e1;
inline void add(ll a) {
	ll b = 1, c = 1;
	int d;
	for (int i = 0; i < (int) primes.size(); i++) {
		if (a % primes[i] == 0) {
			d = 0;
			while (a % primes[i] == 0) {
				a /= primes[i];
				d++;
			}
			d %= 3;
			if (d == 1) {
				b *= primes[i];
				c *= sqr((ll) primes[i]);
			}
			if (d == 2) {
				b *= sqr((ll) primes[i]);
				c *= primes[i];
			}
			if (c > 1e10) {
				ans++;
				return;
			}
		}
	}
	if (a > 1) {
		ld s = sqrt(a) + E;
		ll e = s;
		if (e * e == a) {
			b *= e * e;
			c *= e;
			a = 1;
		}
	}
	if(a > 1 && a <= 1e5){
		b *= a;
		if(c > 1e6){
			ans++;
			return;
		}
		c *= a * a;
		a = 1;
	}
	if (a > 1 || c > 1e10) {
		ans++;
		return;
	}
	if (b == 1) {
		cubes++;
		return;
	}
	//cout << b << " " << c << endl;
	m1[b]++;
	m2[b] = c;
	m2[c] = b;
	m1[c];
}

int main() {
	srand(time(NULL));
	cout.precision(10);
	cout << fixed;
	sync;
#ifdef LOCAL
	input;
#else

#endif

	for (int i = 2; i < MAX; i++)
		prime[i] = true;
	int s = sqrt(MAX);
	for (int i = 2; i < MAX; i++) {
		if (prime[i]) {
			primes.push_back(i);
			if (i <= s) {
				for (int j = i * i; j < MAX; j += i)
					prime[j] = false;
			}
		}
	}

	int n;
	cin >> n;

	for (int i = 0; i < n; i++) {
		ll a = 1e10;
		cin >> a;
		add(a);
	}

	if (cubes)
		ans++;
	ll d;
	for (map<ll, ll>::iterator it = m1.begin(); it != m1.end(); it++) {
		d = max(m1[m2[it->first]], it->second);
		m1[it->first] = 0;
		m1[m2[it->first]] = 0;
		ans += d;
	}

	cout << ans << endl;

}


Measured memory_bytes: 20864