// Copyright (C) 2017 __debug.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>

#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

using std::pair;
using std::vector;
using std::string;

typedef long long LL;
typedef pair<int, int> Pii;

const int oo = 0x3f3f3f3f;

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
    int f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        f = (ch == '-' ? -1 : 1);
    for (x = 0; isdigit(ch); ch = getchar())
        x = 10 * x + ch - '0';
    return x *= f;
}
template<typename T> void write(T x)
{
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[20];
    int top = 0;
    for (; x; x /= 10)
        s[++top] = x % 10 + '0';
    while (top)
        putchar(s[top--]);
}
// EOT

const int MAXN = 1e5 + 5;
const int RNG2 = 1e5 + 5, RNG3 = 2205;

int N;
LL A[MAXN];

void input()
{
    read(N);
    for (int i = 1; i <= N; ++i) {
        read(A[i]);
    }
}

int primes[RNG2], totprimes;
bool composite[RNG2];

void sieve(int n)
{
    for (int i = 2; i < n; ++i) {
        if (!composite[i])
            primes[totprimes++] = i;
        for (int j = 0, x; (x = primes[j] * i) < n; ++j) {
            composite[x] = true;
            if (i % primes[j] == 0)
                break;
        }
    }
}

void solve()
{
    sieve(RNG2);

    std::map<pair<LL, Pii>, int> cnt;
    int ans = 0;

    for (int i = 1; i <= N; ++i) {
        LL x = A[i];
        LL sig = 1;
        int tot = 0, mask = 0;
        for (int j = 0; primes[j] < RNG3; ++j) {
            int t = 0;
            for (; x % primes[j] == 0; x /= primes[j]) {
                ++t;
            }
            if (t % 3 != 0) {
                sig *= primes[j];
                mask |= (t % 3 - 1) << tot++;
            }
        }
        if (x > 1) {
            LL t = roundl(sqrtl((long double)x));
            if (t * t == x) {
                assert(!composite[t]);
                sig *= t;
                mask |= 1 << tot++;
            } else if (x < RNG2 && !composite[x]) {
                sig *= x;
                mask |= 0 << tot++;
            } else {
                // printf("choose %lld directly\n", A[i]);
                ++ans;
                continue;
            }
        }
        ++cnt[MP(sig, MP(tot, mask))];
    }

    for (auto x : cnt) {
        if (x.x.y.x == 0)
            ++ans;
        else {
            auto y = cnt.find(MP(x.x.x, MP(x.x.y.x, ((1 << x.x.y.x) - 1) ^ x.x.y.y)));
            if (y == cnt.end() || y->y < x.y || (y->y == x.y && y->x.y.y < x.x.y.y))
                ans += x.y;
        }
    }

    printf("%d\n", ans);
}

int main()
{
#ifdef __DEBUG
    freopen("D.in", "r", stdin);
    freopen("D.out", "w", stdout);
#endif

    input();
    solve();

    return 0;
}

// 昨夜雨疏风骤，浓睡不消残酒。
//     -- 李清照《如梦令·昨夜雨疏风骤》


Measured memory_bytes: 6400