/+ dub.sdl:
    name "A"
    dependency "dcomp" version=">=0.6.0"
+/

import std.stdio, std.algorithm, std.range, std.conv;
import std.typecons;
// import dcomp.foundation, dcomp.scanner;

// import dcomp.array;
// import dcomp.ldc.inline;

int[] primeList(int n) {
    bool[] used = new bool[n+1];
    FastAppender!(int[]) ans;
    foreach (i; 2..n+1) {
        if (used[i]) continue;
        ans ~= i;
        foreach (j; iota(i, n+1, i)) {
            used[j] = true;
        }
    }
    return ans.data;
}

int[long] fastFactor(ulong x, in BarrettULong[] primes) {
    int[long] mp;
    foreach (p; primes) {
        while (x%p == 0) {
            mp[p.v]++;
            x=x/p;
        }
    }
    if (x) mp[x]++;
    return mp;
}

long mul(long x, long y) {
    if (10L^^12 / x < y) return 10L^^12;
    return x*y;
}

int main() {
    auto sc = new Scanner(stdin);
    auto pr = primeList(100_100);
    auto bpr = pr.map!(x => BarrettULong(x)).array;
    int n;
    sc.read(n);
    int[2][long] g;
    bool one = false;
    foreach (i; 0..n) {
        long s;
        sc.read(s);
//        writeln(fastFactor(s, bpr));
        long d0 = 1, d1 = 1;
        foreach (p, c; fastFactor(s, bpr)) {
            c %= 3;
            if (c == 1) {
                d0 = mul(d0, p);
                d1 = mul(d1, p);
                d1 = mul(d1, p);
            } else if (c == 2) {
                d0 = mul(d0, p);
                d0 = mul(d0, p);
                d1 = mul(d1, p);
            }
        }
        if (d0 == 1) {
            one = true;
            continue;
        }
        if (d0 < d1) {
            if (d0 in g) {
                g[d0][0]++;
            } else {
                g[d0] = [1, 0];
            }
        } else {
            if (d1 in g) {
                g[d1][1]++;
            } else {
                g[d1] = [0, 1];
            }
        }
    }

    int ans = 0;
    if (one) ans++;
    foreach (u; g) {
        ans += max(u[0], u[1]);
    }
    writeln(ans);
    return 0;
}



struct BarrettULong {
    ulong v, u;
    this(ulong x) {
        this.v = x;
        if (x == 1) return;
        version(LDC) {
            u = inlineIR!(`
                %r0 = zext i64 %0 to i128 
                %r1 = add i128 %r0, 18446744073709551615
                %r2 = udiv i128 %r1, %r0
                %r3 = trunc i128 %r2 to i64
                ret i64 %r3`, ulong)(x);
        } else {
            asm {
                mov RBX, this;
                mov RDX, 1;
                mov RAX, x;
                dec RAX;
                div x;
                mov u[RBX], RAX;
            }
        }
    }
    ulong opBinaryRight(string op:"/")(ulong x) const {
        assert(v != 0);
        if (v == 1) return x;
        ulong r;
        version(LDC) {
            r = inlineIR!(`
                %r0 = zext i64 %0 to i128 
                %r1 = zext i64 %1 to i128
                %r2 = mul i128 %r1, %r0
                %r3 = lshr i128 %r2, 64
                %r4 = trunc i128 %r3 to i64
                ret i64 %r4`, ulong)(u, x);
        } else {
            asm {
                mov RBX, this;
                mov RAX, u[RBX];
                mul x;
                mov r, RDX;
            }
        }
        return r;
    }
    ulong opBinaryRight(string op:"%")(ulong x) const {
        return x - x/this*v;
    }
}
/* IMPORT /Users/yosupo/Program/dcomp/source/dcomp/array.d */
// module dcomp.array;

T[N] fixed(T, int N)(T[N] a) {return a;}

//this is not reference type!(please attention to copy)
struct FastAppender(A) {
    import std.algorithm : max;
    import std.range.primitives : ElementEncodingType;
    import core.stdc.string : memcpy;

    private alias T = ElementEncodingType!A;
    private T* _data;
    private size_t len, cap;
    @property size_t length() {return len;}
    void reserve(size_t nlen) {
        import core.memory : GC;
        if (nlen <= cap) return;
        
        void* nx = GC.malloc(nlen * T.sizeof);

        cap = nlen;
        if (len) memcpy(nx, _data, len * T.sizeof);
        _data = cast(T*)(nx);
    }
    void opOpAssign(string op : "~")(T item) {
        if (len == cap) {
            reserve(max(4, cap*2));
        }
        _data[len++] = item;
    }
    void clear() {
        len = 0;
    }    
    T[] data() {
        return (_data) ? _data[0..len] : null;
    }
}

unittest {
    import std.stdio, std.algorithm;
    auto u = FastAppender!(int[])();
    u ~= 4; u ~= 5;
    assert(equal(u.data, [4, 5]));
}
/* IMPORT /Users/yosupo/Program/dcomp/source/dcomp/scanner.d */
// module dcomp.scanner;

class Scanner {
    import std.stdio : File;
    import std.conv : to;
    import std.range : front, popFront, array, ElementType;
    import std.array : split;
    import std.traits : isSomeChar, isStaticArray, isArray; 
    import std.algorithm : map;
    File f;
    this(File f) {
        this.f = f;
    }
    char[512] lineBuf;
    char[] line;
    private bool succ() {
        import std.range.primitives : empty, front, popFront;
        import std.ascii : isWhite;
        while (true) {
            while (!line.empty && line.front.isWhite) {
                line.popFront;
            }
            if (!line.empty) break;
            if (f.eof) return false;
            line = lineBuf[];
            f.readln(line);
        }
        return true;
    }

    private bool readSingle(T)(ref T x) {
        import std.algorithm : findSplitBefore;
        import std.string : strip;
        import std.conv : parse;
        if (!succ()) return false;
        static if (isArray!T) {
            alias E = ElementType!T;
            static if (isSomeChar!E) {
                //string or char[10] etc
                //todo optimize
                auto r = line.findSplitBefore(" ");
                x = r[0].strip.dup;
                line = r[1];
            } else {
                auto buf = line.split.map!(to!E).array;
                static if (isStaticArray!T) {
                    //static
                    assert(buf.length == T.length);
                }
                x = buf;
                line.length = 0;
            }
        } else {
            x = line.parse!T;
        }
        return true;
    }
    int read(T, Args...)(ref T x, auto ref Args args) {
        if (!readSingle(x)) return 0;
        static if (args.length == 0) {
            return 1;
        } else {
            return 1 + read(args);
        }
    }
}



unittest {
    import std.path : buildPath;
    import std.file : tempDir;
    import std.algorithm : equal;
    import std.stdio : File;
    string fileName = buildPath(tempDir, "kyuridenanmaida.txt");
    auto fout = File(fileName, "w");
    fout.writeln("1 2 3");
    fout.writeln("ab cde");
    fout.writeln("1.0 1.0 2.0");
    fout.close;
    Scanner sc = new Scanner(File(fileName, "r"));
    int a;
    int[2] b;
    char[2] c;
    string d;
    double e;
    double[] f;
    sc.read(a, b, c, d, e, f);
    assert(a == 1);
    assert(equal(b[], [2, 3]));
    assert(equal(c[], "ab"));
    assert(equal(d, "cde"));
    assert(e == 1.0);
    assert(equal(f, [1.0, 2.0]));
}

unittest {
    import std.path : buildPath;
    import std.file : tempDir;
    import std.algorithm : equal;
    import std.stdio : File, writeln;
    import std.datetime;
    string fileName = buildPath(tempDir, "kyuridenanmaida.txt");
    auto fout = File(fileName, "w");
    foreach (i; 0..1_000_000) {
        fout.writeln(3*i, " ", 3*i+1, " ", 3*i+2);
    }
    fout.close;
    writeln("Scanner Speed Test(3*1,000,000 int)");
    StopWatch sw;
    sw.start;
    Scanner sc = new Scanner(File(fileName, "r"));
    foreach (i; 0..500_000) {
        int a, b, c;
        sc.read(a, b, c);
        assert(a == 3*i);
        assert(b == 3*i+1);
        assert(c == 3*i+2);
    }
    foreach (i; 500_000..700_000) {
        int[3] d;
        sc.read(d);
        int a = d[0], b = d[1], c = d[2];
        assert(a == 3*i);
        assert(b == 3*i+1);
        assert(c == 3*i+2);
    }
    foreach (i; 700_000..1_000_000) {
        int[] d;
        sc.read(d);
        assert(d.length == 3);
        int a = d[0], b = d[1], c = d[2];
        assert(a == 3*i);
        assert(b == 3*i+1);
        assert(c == 3*i+2);
    }
    writeln(sw.peek.msecs, "ms");
}
/* IMPORT /Users/yosupo/Program/dcomp/source/dcomp/ldc/inline.d */
// module dcomp.ldc.inline;

version(LDC) {
    pragma(LDC_inline_ir)
        R inlineIR(string s, R, P...)(P);
}
/* IMPORT /Users/yosupo/Program/dcomp/source/dcomp/foundation.d */
// module dcomp.foundation;
//fold(for old compiler)
static if (__VERSION__ <= 2070) {
    template fold(fun...) if (fun.length >= 1) {
        auto fold(R, S...)(R r, S seed) {
            import std.algorithm : reduce;
            static if (S.length < 2) {
                return reduce!fun(seed, r);
            } else {
                import std.typecons : tuple;
                return reduce!fun(tuple(seed), r);
            }
        }
    }
    unittest {
        import std.stdio;
        auto l = [1, 2, 3, 4, 5];
        assert(l.fold!"a+b"(10) == 25);
    }
}


Measured memory_bytes: 12796