#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// Optimization

//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' '; cout << endl;
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' '; cout << endl;
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());
//int randt(int l, int r){ return (rando() % (r - l + 1) + l); }

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const ll N = 1e5 + 5, M = 10000000000ll, K = 2200;
int mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e9 + 7;
ll infll = 1e18 + 7;

int lpf[N];
vector <int> prime;

void sieve(){
    for (int i = 2; i < N; i++){
        if (lpf[i] == 0){
            lpf[i] = i;
            prime.pb(i);
        }
        for (int j = 0; j < prime.size() && prime[j] <= lpf[i] && i * prime[j] < N; j++){
            lpf[i * prime[j]] = prime[j];
        }
    }
}

int n, ckcube;
ll ans;
ll a[N];
map <ll, int> mpp1, mpp2;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    sieve();
    cin >> n;
    ForE(i, 1, n){
        cin >> a[i];
    }
    ForE(i, 1, n){
        bool ck = 0;
        ll x = 1, y = 1; // chia di, nhan len
        For(j, 2, K){ // for uoc < cube root
            int z = 0;
            while (a[i] % j == 0){
                z++;
                a[i] /= j;
            }
            z %= 3;
            if (!z) continue;
            if (z == 1){
                x *= (ll)j;
                y *= (ll)j; if (y > M){ ck = 1; break; }
                y *= (ll)j; if (y > M){ ck = 1; break; }
            }
            else{
                x *= (ll)j;
                x *= (ll)j;
                y *= (ll)j; if (y > M){ ck = 1; break; }
            }
        }
        if (ck){
            ans++;
            continue;
        }
        if (a[i] == 1){ // moi uoc deu <= cube root
            if (x == 1){ // lap phuong
                ckcube = 1;
            }
            else{
                if (x < y) mpp1[x]++;
                else mpp2[y]++;
            }
            continue;
        }
        ll tmpkek = round(sqrtl(a[i]));
        if (tmpkek * tmpkek == a[i]){ // kiem tra chinh phuong
            x *= a[i];
            y *= tmpkek; if (y > M){ ans++; continue; }
            if (x < y) mpp1[x]++;
            else mpp2[y]++;
            continue;
        }
        if (a[i] >= N){ // p hoac pq >= can bac hai 
            ans++;
            continue;
        }
        x *= a[i];
        y *= a[i]; if (y > M){ ans++; continue; }
        y *= a[i]; if (y > M){ ans++; continue; }
        if (x < y) mpp1[x]++;
        else mpp2[y]++;
    }
    Fora(v, mpp1){
        ans += max(v.se, mpp2[v.fi]);
    }
    Fora(v, mpp2){
        if (mpp1.find(v.fi) == mpp1.end()) ans += v.se;
    }
    ans += ckcube;
    cout << ans;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 15520