// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
// #include "../debug/debug.cpp"
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

V<ll> primes;
V<ll> pow2_p;

void calc_primes() {
    const size_t size = 1e5 + 10;
    bool used[size] = {};
    for(ll i = 2; i < size; i++) {
        if(used[i]) continue;
        primes.push_back(i);
        pow2_p.push_back(i * i);
        for(ll j = 1; i * j < size; j++) used[i * j] = true;
    }
}

int main() {
    calc_primes();
    ll N;
    cin >> N;
    ll ans = 0;
    map<ll, ll> cnt;
    map<ll, ll> anti;

    while(N--) {
        ll e;
        cin >> e;
        ll save_e = 1;
        ll anti_num = 1;
        bool non = false;
        for(ll p : primes) {
            ll cube_p = p * p * p;
            if(1e10 < cube_p) break;
            while(e % cube_p == 0) e /= cube_p;
            ll cnt_div = 0;
            while(e % p == 0) {
                e /= p;
                cnt_div++;
            }
            for(ll i = 0; i < cnt_div; i++) save_e *= p;
            ll anti_cnt_div = (3 - cnt_div) % 3;
            for(ll i = 0; i < anti_cnt_div; i++) {
                anti_num *= p;
                if(1e10 < anti_num) {
                    non = true;
                    break;
                }
            }
            if(non) break;
        }

        if(!non && e != 1) {
            auto ite = lower_bound(ALL(pow2_p), e);
            save_e *= e;
            if(ite != pow2_p.end() && *ite == e) {
                auto idx = distance(pow2_p.begin(), ite);
                anti_num *= primes[idx];
            } else {
                if(numeric_limits<ll>::max() / e < e) non = true;
                else if(numeric_limits<ll>::max() / anti_num < e * e) non = true;
                else anti_num *= e * e;
            }
            if(1e10 < anti_num) non = true;
        }

        if(non) {
            ans++;
            continue;
        }

        DEBUG(make_tuple(e, anti_num));
        anti[save_e] = anti_num;
        cnt[save_e]++;
    }

    for(auto &&ele : cnt) {
        ll num, cnt_v;
        tie(num, cnt_v) = ele;
        ll anti_num = anti[num];
        // DEBUG(make_tuple(num, anti_num, cnt_v));
        auto ite = cnt.find(anti_num);
        if(ite == cnt.end()) {
            ans += cnt_v;
            continue;
        }
        if(anti_num != 0 && anti_num < num) continue;
        if(num == 1) ans++;
        else ans += max(cnt_v, ite->second);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11008