import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	
	int n = readln.chomp.to!int;
	long[] ss;
	for(int i = 0; i < n; i ++){
		ss ~= readln.chomp.to!long;
		}
	
	int[] primes;
	bool[] flags = new bool[100_009];
	for(int i = 2; i < flags.length; i ++){
		if(!flags[i]){
			primes ~= i;
			for(int j = i; j < flags.length; j += i) flags[j] = 1;
			}
		}
	
	int[long] count, anticount;
	
	foreach(s; ss){
		long x = 1, y = 1;
		foreach(p; primes){
			int c = 0;
			while(s % p == 0) s /= p, c += 1;
			if(c % 3 == 1) x *= p, y *= p * p;
			if(c % 3 == 2) x *= p * p, y *= p;
			}
		
		if(s > 1) continue; // s is prime
		
		if(x in count) count[x] += 1;
		else if(y in count) anticount[y] += 1;
		else count[x] = 1;
		}
	
	int ans = n;
	
	foreach(x; count.keys){
		if(x == 1) ans -= count[x] - 1;
		if(!(x in anticount)) continue;
		if(count[x] > anticount[x]) ans -= anticount[x];
		else ans -= count[x];
		}
	
	ans.writeln;
	
	}