import std.stdio, std.string, std.conv;
import std.algorithm, std.array;
import std.math;
 
auto solve(string s_)
{
    immutable N = s_.to!int();
    auto AS = new long[N];
    int[long] b; b[1]=0;
    foreach(k;0..N)
    {
        auto v=readln.chomp().to!long();
        for(long i=2,i3; (i3=i*i*i)<=v; ++i)
            while(v%i3==0) v/=i3;
        AS[k]=v;
        if(v !in b) b[v]=1;
        else ++b[v];
    }
    b[1]=min(1,b[1]);
    sort(AS);
    bool[long] u;
    int m=0;
    foreach(v;AS)
    {
        stderr.writeln(v);
        if(v in u) continue;
        auto vv=v*v;
        if(v>int.max || vv !in b) vv=v;
        m+=max(b[v],b[vv]);
        u[v]=true,u[vv]=true;
    }
    return m;
}

void main(){ for(string s; (s=readln.chomp()).length;) writeln(solve(s)); }