Problem:
Score : 1100 points

Problem Statement

Snuke got positive integers s_1,...,s_N from his mother, as a birthday present. There may be duplicate elements.

He will circle some of these N integers. Since he dislikes cubic numbers, he wants to ensure that if both s_i and s_j (i ≠ j) are circled, the product s_is_j is not cubic. For example, when s_1=1,s_2=1,s_3=2,s_4=4, it is not possible to circle both s_1 and s_2 at the same time. It is not possible to circle both s_3 and s_4 at the same time, either.

Find the maximum number of integers that Snuke can circle.

Constraints

1 ≦ N ≦ 10^5

1 ≦ s_i ≦ 10^{10}

All input values are integers.

Input

The input is given from Standard Input in the following format:

N
s_1
:
s_N

Output

Print the maximum number of integers that Snuke can circle.

Sample Input 1

8
1
2
3
4
5
6
7
8

Sample Output 1

6

Snuke can circle 1,2,3,5,6,7.

Sample Input 2

6
2
4
8
16
32
64

Sample Output 2

3

Sample Input 3

10
1
10
100
1000000007
10000000000
1000000009
999999999
999
999
999

Sample Output 3

9

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include <climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n;
int a[200000];
int d[200000];
vector<int>b;
string s[200000];
struct A {
	string s;
	int num;
};
vector<string>c, e;
vector<A>f;
char g[] = { '0','1','2' };
char o[] = { '0','2','1' };
signed main() {
	for (int i = 2; i < 200000; i++) {
		d[i] = 1;
	}
	for (int i = 2; i <= 100000; i++) {
		if (d[i]) {
			for (int j = 2 * i; j <= 100000; j += i) {
				d[j] = 0;
			}
		}
	}
	for (int i = 0; i <= 100000; i++) {
		if (d[i]) b.push_back(i);
	}
	cin >> n;
	int ans = 0;
	bool l = 1;
	for (int i = 0; i < n; i++) {
		scanf("%lld", &a[i]);
		string h = "";
		int r = 0;
		int sum = 0;
		for (int j = 0; j < b.size(); j++) {
			if (a[i] % b[j] > 0) continue;
			sum = 0;
			while (a[i] % b[j] == 0) {
				a[i] /= b[j];
				sum++;
				if (sum > 100) {
					cout << 1 / 0 << endl;
				}
			}
		//	h += g[sum % 3];
			r += sum % 3;
		}
		/*if (a[i] > 1) {
			ans++;
		}
		else if (r == 0) {
			if (l) {
				ans++;
				l = 0;
			}
		}
		else {
			e.push_back(h);
		}*/
	}
	/*sort(all(e));
	for (int i = 0; i < e.size(); ) {
		int j = i;
		while (j < e.size() && e[i] == e[j]) j++;
		f.push_back(A{ e[i],j - i });
		c.push_back(e[i]);
		i = j;
	}
	int sum = 0;
	for (int i = 0; i < c.size(); i++) {
		string h = "";
		for (int j = 0; j < b.size(); j++) {
			h += to_string((3 - (int)(c[i][j] - '0')) % 3);
		}
		int k = lower_bound(all(c), h) - c.begin();
		if (k == c.size() || c[k] != h) {
			ans += f[i].num;
		}
		else {
			sum += max(f[i].num, f[k].num);
		}
	}
	cout << ans + sum / 2 << endl;*/
}