//============================================================================
// Name        : Calc.cpp
// Author      : Roman
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <ctime>

using namespace std;

bool input = true;
bool c = false;

struct test_input {
	int n;
	vector < long long > x;
	test_input(int n, vector < long long > x) : n(n), x(x) {};
	test_input() {};
};

vector < long long > primes(int n) {
	vector < int > used(n);
	vector < long long > ans;
	ans.reserve(n);
	for (int i = 2; i < n; ++i) {
		if (!used[i]) {
			ans.push_back(i);
			for (int j = i + i; j < n; j += i) {
				used[j] = 1;
			}
		}
	}
	return ans;
}

vector < long long > pow_3 (int n) {
	vector < long long > ans (n);
	for (long long i = 0; i < n; ++i) {
		ans[i] = i * i * i;
	}
	return ans;
}

void del_pow_3 (vector < long long > &x, vector < long long > &pr) {
	for (int i = 0; i < x.size(); ++i) {
		if (c) cout << x[i] << " ";
		long long temp = x[i];
		long long res = 1;
		for (int j = 0; j < pr.size() && pr[j] < temp; ++j) {
			int cnt = 0;
			while (temp % pr[j] == 0) {
				cnt++;
				temp /= pr[j];
			}
			cnt %= 3;
			while (cnt) {
				cnt--;
				res *= pr[j];
			}
		}
		res *= temp;
		x[i] = res;
		if (c) cout << x[i] << endl;
	}
}

struct test_input read_data (){
	int n;
	cin >> n;
	vector < long long > x(n);
	for (auto &p: x) {
		cin >> p;
	}
	return test_input(n, x);
}

struct test_input stress_data (){
	int n;
	cin >> n;
	vector < long long > x(n, 1e9 + 7);
	return test_input(n, x);
}

long long get_op_el (long long el, vector < long long > &pr, set < long long > &all_pr, set < long long > &sq_pr, map < long long, long long > &to_pr) {
	long long res = 1;
	for (int i = 0; i < pr.size(); ++i) {
		int cnt = 0;
		while (el % pr[i] == 0) {
			el /= pr[i];
			cnt++;
		}
		cnt = 3 - cnt;
		cnt %= 3;
		while (cnt) {
			res *= pr[i];
			cnt--;
		}
	}
	if (el != 1) {
		if (all_pr.find(el) != all_pr.end()) {
			res *= (el * el);
			el = 1;
		}
		if (sq_pr.find(el) != sq_pr.end()) {
			res *= to_pr[el];
			el = 1;
		}
	}
	if (el != 1) {
		return -1;
	} else {
		return res;
	}
}

set < long long > cr_set (vector < long long > &x) {
	set < long long > ans;
	for (auto p: x) {
		ans.insert(p);
	}
	return ans;
}

struct node {
	long long num;
	int cnt;
	int op_idx;
};

void solution () {
	test_input in;
	if (input) {
		in = read_data();
	} else {
		in = stress_data();
	}
	auto pr = primes(2200);
	if (c) cout << pr.size() << endl;
	del_pow_3(in.x, pr);
	vector < node > nodes;
	sort(in.x.begin(), in.x.end());
	set < long long > exist = cr_set(in.x);
	map < long long , int > to_idx;
	auto _pr = primes(100000);
	set < long long > all_pr = cr_set(_pr);
	set < long long > sq_pr;
	map < long long, long long > to_pr;
	for (auto &p: _pr) {
		to_pr[p * p] = p;
		sq_pr.insert(p * p);
	}
	// *** //
	long long ans = 0;
	if (c) cout << pr.size() << endl;
	for (int i = 0; i < in.x.size(); ++i) {
		if (to_idx.find(in.x[i]) == to_idx.end()) {
			long long op_el = get_op_el(in.x[i], pr, all_pr, sq_pr, to_pr);
			if (exist.find(op_el) == exist.end()) {
				ans++;
				continue;
			}
			node to_add;
			to_add.cnt = 1;
			to_add.num = in.x[i];
			to_add.op_idx = -1;
			if (to_idx.find(op_el) != to_idx.end()) {
				// cout << in.x[i] << " " << op_el << " " << to_idx[op_el] << endl;
				to_add.op_idx = to_idx[op_el];
				nodes[to_idx[op_el]].op_idx = nodes.size();
			}
			to_idx[in.x[i]] = nodes.size();
			nodes.push_back(to_add);
		} else {
			nodes[to_idx[in.x[i]]].cnt++;
		}
	}
	for (int i = 0; i < nodes.size(); ++i) {
		// cout << i << " " << nodes[i].num << " " << nodes[i].cnt << " " << nodes[i].op_idx << endl;
		if (nodes[i].num == 1) {
			ans++;
			continue;
		}
		if (nodes[i].op_idx != -1) {
			ans += max(nodes[i].cnt, nodes[nodes[i].op_idx].cnt);
			nodes[i].cnt = 0;
			nodes[nodes[i].op_idx].cnt = 0;
		}
		ans += nodes[i].cnt = 0;
	}
	cout << ans;
}




int main() {
	//ifstream cin ("/Users/Roman/ClionProjects/Calculations/input.txt");
	//ofstream cout ("/Users/Roman/ClionProjects/Calculations/output.txt");

	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);

	cout.setf(ios_base::fixed);
	cout.precision(10);
	srand(time(NULL));
	//long long a = 2200;
	//cout << a * a * a;
	solution();

	return 0;
}



Measured memory_bytes: 7264