/+ 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.barrettint;
 
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.value]++;
            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 sc = new Scanner(File("01.txt", "r"));
    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;
}
/* 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/barrettint.d */
// module dcomp.barrettint;

// import dcomp.int128;

struct BarrettULong {
    ulong value, m;
    int lg;
    this(ulong value) {
        import core.bitop : bsr;
        this.value = value;
        if (value <= 1) return;
        lg = value.bsr;
        if (1UL<<lg != value) lg++;
        m = div128([0UL, (2UL<<(lg-1))-value], value)+1;
    }
    ulong opBinaryRight(string op:"/")(ulong x) const {
        assert(value != 0);
        if (value == 1) return x;
        ulong r;
        r = mul128(m, x)[1];
        r = (r + ((x-r)>>1)) >> (lg-1);
        return r;
    }
    ulong opBinaryRight(string op:"%")(ulong x) const {
        return x - x/this*value;
    }
}

unittest {
    ulong[] up;
    ulong[] down;
    up ~= 0;
    foreach (ulong i; 1..1000) {
        up ~= i;
        up ~= -i;
    }
    foreach (ulong i; 1..1000) {
        down ~= i;
        down ~= -i;
    }
    foreach (ulong i; down) {
        auto b = BarrettULong(i);
        foreach (ulong j; up) {
            assert(j/b == j/i);
            assert(j%b == j%i);
        }
    }
}
/* 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);
    }
}
/* 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/int128.d */
// module dcomp.int128;

version(LDC) {
//     import dcomp.ldc.inline;
}

ulong[2] mul128(ulong a, ulong b) {
    ulong[2] res;
    version(LDC) {
        ulong upper, lower;
        inlineIR!(`
            %r0 = zext i64 %0 to i128 
            %r1 = zext i64 %1 to i128
            %r2 = mul i128 %r1, %r0
            %r3 = trunc i128 %r2 to i64
            %r4 = lshr i128 %r2, 64
            %r5 = trunc i128 %r4 to i64
            store i64 %r3, i64* %2
            store i64 %r5, i64* %3`, void)(a, b, &lower, &upper);
        return [lower, upper];
    } else version(D_InlineAsm_X86_64) {
        ulong upper, lower;
        asm {
            mov RAX, a;
            mul b;
            mov lower, RAX;
            mov upper, RDX;
        }
        return [lower, upper];
    } else {
        pragma(msg, "Not Supported");
    }    
}

ulong div128(ulong[2] a, ulong b) {
    version(LDC) {
        return inlineIR!(`
            %r0 = zext i64 %0 to i128
            %r1 = zext i64 %1 to i128
            %r2 = shl i128 %r1, 64
            %r3 = add i128 %r0, %r2
            %r4 = zext i64 %2 to i128
            %r5 = udiv i128 %r3, %r4
            %r6 = trunc i128 %r5 to i64
            ret i64 %r6`,ulong)(a[0], a[1], b);
    } else version(D_InlineAsm_X86_64) {
        ulong upper = a[1], lower = a[0];
        ulong res;
        asm {
            mov RDX, upper;
            mov RAX, lower;
            div b;
            mov res, RAX;
        }
        return res;
    } else {
        pragma(msg, "Not Supported");
    }    
}


Measured memory_bytes: 14332