#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
 
#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")
 
using namespace std;

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define endl '\n';
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <class T> inline T gcd(T a, T b) { while (b) { a %= b; swap(a, b); } return a; }
template <class T> inline T lcm(T a, T b) { return a * b / gcd(a, b); }

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
    #define eprintf(...) 42
#endif

clock_t startTime;
double getCurrentTime() {
    return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const ll MOD = (ll)1e9 + 7, INF = (ll)1e18;;
ll add(ll x, ll y) {
    x += y;
    if (x >= MOD) return x - MOD;
    return x;
}
ll sub(ll x, ll y) {
    x -= y;
    if (x < 0) return x + MOD;
    return x;
}
ll mul(ll x, ll y) {
    return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
    if (p == 0) return 1;
    if (p & 1) return mul(x, bin_pow(x, p - 1));
    return bin_pow(mul(x, x), p / 2);
}

ll mult(ll x, ll y) {
    if (INF / x < y) return INF;
    return min(INF, x * y);
}
ll mySqrt(ll x) {
    ll y = (ll)sqrt(x);
    while(y * y > x) y--;
    while(y * y < x) y++;
    if (y * y == x) return y;
    return -1;
}

map<ll, int> mapchik;

ll cubeFree(ll x) {
    ll res = 1;
    for (ll p = 2; p * p * p <= x; p++) {
        if (x % p) continue;
        int t = 0;
        while(x % p == 0) {
            x /= p;
            t++;
        }
        t %= 3;
        while(t--) res *= p;
    }
    return res * x;
}
ll getPair(ll x) {
    ll res = 1;
    for (ll p = 2; p * p * p <= x; p++) {
        if (x % p) continue;
        int t = 0;
        while(x % p == 0) {
            x /= p;
            t++;
        }
        assert(t < 3);
        if (t == 1) {
            res = mult(res, p);
            res = mult(res, p);
        } else {
            res = mult(res, p);
        }
    }
    if (x > 1) {
        ll y = mySqrt(x);
        if (y == -1) {
            res = mult(res, x);
            res = mult(res, x);
        } else {
            res = mult(res, y);
        }
    }
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    startTime = clock();
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    while(n --> 0) {
        ll x;
        cin >> x;
        mapchik[cubeFree(x)]++;
    }
    int ans = 0;
    if (mapchik.count(1)) {
        ans++;
        mapchik.erase(1);
    }
    while(!mapchik.empty()) {
        ll x = mapchik.begin()->first;
        ll y = getPair(x);
        ans += max(mapchik[x], mapchik[y]);
        mapchik.erase(x);
        mapchik.erase(y);
    }
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 9908