import std.stdio, std.string, std.conv;
import std.algorithm, std.array;
import std.bigint, std.math;
 
auto solve(string s_)
{
    immutable N = s_.to!int();
    auto AS = new BigInt[N];
    auto RS = new BigInt[N];
    int[BigInt] b;
    foreach(k;0..N)
    {
        BigInt p=1,q=1,v=readln.chomp().to!BigInt();
        for(BigInt i=2; i*i<=v; ++i)
        {
            int c=0;
            while(v%i==0) v/=i, ++c;
            c%=3;
            if(c!=0)
            {
                foreach(j;0..c) p*=i;
                foreach(j;0..3-c) q*=i;
            }
        }
        if(v>1) p*=v, q*=v*v;
        AS[k]=p;
        RS[k]=q;
        if(p !in b) b[p]=1;
        else ++b[p];
        if(q !in b) b[q]=0;
    }
    bool[BigInt] u;
    int m=0;
    foreach(k;0..N)
    {
        immutable p=AS[k];
        if(p in u) continue;
        if(p==1){ ++m; u[p]=true; continue; }
        immutable q=RS[k];
        m+=max(b[p],b[q]);
        u[p]=true,u[q]=true;
    }
    return m;
}

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