///#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,popcnt,avx,avx2,tune=native")

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

/*
    zet:
        find_by_order(k): k-stat [k > 0]
        order_of_key(k) : {el < k}

    gp_hash_table<key, val, custom_hash>

    rope<T>:
        iterators: mutable_begin, ..
        methods  : erase, insert, substr, ..
*/

#define all(x) (x).begin(), (x).end()
#define size(x) (int)((x).size())
#define em_back emplace_back

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<typename T>
using zet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

mt19937 eng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 1e5 + 4;
const int MX = cbrt(1e10) + 4;

ll m, cube, ans;
map<vector<pll>, int> cnt;
map<vector<pll>, bool> used;

vector<ll> cubes;

bool isCube(ll x) {
    return binary_search(all(cubes), x);
}

bool pused[N];
vector<ll> prime;

void factor(ll a) {
    vector<ll> p;
    int last = 0;
    for (int i = 0; i < size(prime); ++i) {
        ll pt = prime[i];
        if (pt * pt > a || pt > MX) {
            last = i;
            break;
        }
        while (a % pt == 0) {
            p.em_back(pt);
            a /= pt;
        }
    }
    if (a > 1) {
        if (a > 1e5) {
            ll sq = sqrt(a);
            if (sq * sq == a) {
                p.em_back(sq);
                p.em_back(sq);
            } else {
                ++ans;
                return;
            }
        } else {
            p.em_back(a);
        }
    }
    sort(all(p));

    vector<pll> res;
    for (int i = 0; i < size(p);) {
        int j = i;
        while (j < size(p) && p[i] == p[j]) {
            ++j;
        }
        if ((j - i) % 3 != 0) {
            res.em_back(p[i], (j - i) % 3);
        }
        i = j;
    }
    cnt[res]++;
}

void prepare() {
    for (int i = 2; i < N; ++i) {
        if (pused[i]) {
            continue;
        }
        for (ll j = (ll)i * i; j < N; j += i) {
            pused[j] = 1;
        }
    }
    for (int i = 2; i < N; ++i) if (!pused[i]) {
        prime.em_back(i);
    }

    for (ll i = 1; i < 1e4; ++i) {
        cubes.em_back(i * i * i);
    }
}

void read() {
    cin >> m;
    for (int i = 0; i < m; ++i) {
        ll a;
        cin >> a;
        if (isCube(a)) {
            ++cube;
        } else {
            factor(a);
        }
    }
}

void solve() {
    read();

    for (auto u : cnt) {
        auto fu = u.first;

        if (used[fu]) {
            continue;
        }

        auto fv = fu;
        for (pll& p : fv) {
            p.second = 3 - p.second;
        }

        int ucnt = u.second;
        int vcnt = (cnt.count(fv) ? cnt[fv] : 0);

        ans += max(ucnt, vcnt);

        used[fu] = used[fv] = 1;
    }

    cout << ans + (cube > 0) << "\n";
}

int main() {
    ios::sync_with_stdio(0);
    cout.tie(0), cin.tie(0);

    prepare();

    int z = 1;
    /// cin >> z;

    while (z--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 36988