#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
#define asn ans
bool dbg = false;
int intpow(int a, int b) {
    int ans = 1;
    while (b) {
        if (b & 1)
            ans *= a;
        a *= a;
        b /= 2;
    }
    return ans;
}

pair<int, int> f(int n) {
    int ret1{1}, ret2{1};
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            int num = 0;
            while (n % i == 0) {
                num++;
                n /= i;
            }
            num %= 3;
            if (num > 0) {
                ret1 *= intpow(i, num);
                ret2 *= intpow(i, 3);
            }
        }
    }
    if (n != 1) {
        ret1 *= n;
        ret2 *= intpow(n, 3);
    }
    ret2 /= ret1;
    return {ret1, ret2};
}

namespace FastPrimeFactorization {

template <typename word, typename dword, typename sword>
struct UnsafeMod {
    UnsafeMod() : x(0) {}

    UnsafeMod(word _x) : x(init(_x)) {}

    bool operator==(const UnsafeMod& rhs) const {
        return x == rhs.x;
    }

    bool operator!=(const UnsafeMod& rhs) const {
        return x != rhs.x;
    }

    UnsafeMod& operator+=(const UnsafeMod& rhs) {
        if ((x += rhs.x) >= mod)
            x -= mod;
        return *this;
    }

    UnsafeMod& operator-=(const UnsafeMod& rhs) {
        if (sword(x -= rhs.x) < 0)
            x += mod;
        return *this;
    }

    UnsafeMod& operator*=(const UnsafeMod& rhs) {
        x = reduce(dword(x) * rhs.x);
        return *this;
    }

    UnsafeMod operator+(const UnsafeMod& rhs) const {
        return UnsafeMod(*this) += rhs;
    }

    UnsafeMod operator-(const UnsafeMod& rhs) const {
        return UnsafeMod(*this) -= rhs;
    }

    UnsafeMod operator*(const UnsafeMod& rhs) const {
        return UnsafeMod(*this) *= rhs;
    }

    UnsafeMod pow(uint64_t e) const {
        UnsafeMod ret(1);
        for (UnsafeMod base = *this; e; e >>= 1, base *= base) {
            if (e & 1)
                ret *= base;
        }
        return ret;
    }

    word get() const {
        return reduce(x);
    }

    static constexpr int word_bits = sizeof(word) * 8;

    static word modulus() {
        return mod;
    }

    static word init(word w) {
        return reduce(dword(w) * r2);
    }

    static void set_mod(word m) {
        mod = m;
        inv = mul_inv(mod);
        r2 = -dword(mod) % mod;
    }

    static word reduce(dword x) {
        word y = word(x >> word_bits) - word((dword(word(x) * inv) * mod) >> word_bits);
        return sword(y) < 0 ? y + mod : y;
    }

    static word mul_inv(word n, int e = 6, word x = 1) {
        return !e ? x : mul_inv(n, e - 1, x * (2 - x * n));
    }

    static word mod, inv, r2;

    word x;
};

using uint128_t = __uint128_t;

using Mod64 = UnsafeMod<uint64_t, uint128_t, int64_t>;
template <>
uint64_t Mod64::mod = 0;
template <>
uint64_t Mod64::inv = 0;
template <>
uint64_t Mod64::r2 = 0;

using Mod32 = UnsafeMod<uint32_t, uint64_t, int32_t>;
template <>
uint32_t Mod32::mod = 0;
template <>
uint32_t Mod32::inv = 0;
template <>
uint32_t Mod32::r2 = 0;

bool miller_rabin_primality_test_uint64(uint64_t n) {
    Mod64::set_mod(n);
    uint64_t d = n - 1;
    while (d % 2 == 0)
        d /= 2;
    Mod64 e{1}, rev{n - 1};
    // http://miller-rabin.appspot.com/  < 2^64
    for (uint64_t a : {2, 325, 9375, 28178, 450775, 9780504, 1795265022}) {
        if (n <= a)
            break;
        uint64_t t = d;
        Mod64 y = Mod64(a).pow(t);
        while (t != n - 1 && y != e && y != rev) {
            y *= y;
            t *= 2;
        }
        if (y != rev && t % 2 == 0)
            return false;
    }
    return true;
}

bool miller_rabin_primality_test_uint32(uint32_t n) {
    Mod32::set_mod(n);
    uint32_t d = n - 1;
    while (d % 2 == 0)
        d /= 2;
    Mod32 e{1}, rev{n - 1};
    for (uint32_t a : {2, 7, 61}) {
        if (n <= a)
            break;
        uint32_t t = d;
        Mod32 y = Mod32(a).pow(t);
        while (t != n - 1 && y != e && y != rev) {
            y *= y;
            t *= 2;
        }
        if (y != rev && t % 2 == 0)
            return false;
    }
    return true;
}

bool is_prime(uint64_t n) {
    if (n == 2)
        return true;
    if (n == 1 || n % 2 == 0)
        return false;
    if (n < uint64_t(1) << 31)
        return miller_rabin_primality_test_uint32(n);
    return miller_rabin_primality_test_uint64(n);
}

uint64_t pollard_rho(uint64_t n) {
    if (is_prime(n))
        return n;
    if (n % 2 == 0)
        return 2;
    Mod64::set_mod(n);
    uint64_t d;
    Mod64 one{1};
    for (Mod64 c{one};; c += one) {
        Mod64 x{2}, y{2};
        do {
            x = x * x + c;
            y = y * y + c;
            y = y * y + c;
            d = __gcd((x - y).get(), n);
        } while (d == 1);
        if (d < n)
            return d;
    }
    assert(0);
}

vector<uint64_t> prime_factor(uint64_t n) {
    if (n <= 1)
        return {};
    uint64_t p = pollard_rho(n);
    if (p == n)
        return {p};
    auto l = prime_factor(p);
    auto r = prime_factor(n / p);
    copy(begin(r), end(r), back_inserter(l));
    return l;
}
};  // namespace FastPrimeFactorization
//ei1333さんありがとうございます

int N, S[101010];
map<int, int> M;
map<int, int> rev;

void solve() {
    FOR (N) {
        /*
        auto tmp = f(S[i]);
        M[tmp.first]++;
        rev[tmp.first] = tmp.second;
        */
        auto tmp = FastPrimeFactorization::prime_factor(S[i]);
        sort(all(tmp));
        int x = 1, y = 1;
        auto it = tmp.begin();
        while (it != tmp.end()) {
            int a = *it;
            int n = upper_bound(all(tmp), a) - lb(all(tmp), a);
            n %= 3;
            if (n > 0) {
                x *= intpow(a, n);
                y *= intpow(a, 3 - n);
            }
            it = upper_bound(all(tmp), a);
        }
        M[x]++;
        rev[x] = y;
    }
    int ans = 0;
    while (!M.empty()) {
        auto p = *M.begin();
        if (p.first == 1)
            ans++;
        else {
            ans += max(p.second, M.count(rev[p.first]) ? M[rev[p.first]] : 0ll);
        }
        //cout << p.first << " " << rev[p.first] << endl;
        M.erase(p.first);
        M.erase(rev[p.first]);
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N;
    FOR (N)
        cin >> S[i];


    solve();
    return 0;
}


Measured memory_bytes: 13568