#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

namespace fact{
  ll gcd(ll _a, ll _b) {
    unsigned long long a = abs(_a), b = abs(_b);
    if(a == 0) return b;
    if(b == 0) return a;
    int shift = __builtin_ctzll(a | b);
    a >>= __builtin_ctzll(a);
    do {
      b >>= __builtin_ctzll(b);
      if(a > b) std::swap(a, b);
      b -= a;
    }while(b);
    return (a << shift);
  }
  template <class T, class U>
  T modpow(T x, U n, T md) {
      T r = 1 % md;
      x %= md;
      while(n) {
          if(n & 1) r = (r * x) % md;
          x = (x * x) % md;
          n >>= 1;
      }
      return r;
  }
  bool is_prime(ll n) {
    if(n<=1) return false;
    if(n==2) return true;
    if(n%2==0) return false;
    ll d = n - 1;
    while(d % 2 == 0) d /= 2;
    for(ll a : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37}) {
      if(n <= a) break;
      ll t = d, y = modpow<__int128_t>(a, t, n);
      while(t != n - 1 && y != 1 && y != n - 1) {
        y = __int128_t(y) * y % n, t <<= 1;
      }
      if(y != n - 1 && t % 2 == 0) {
        return false;
      }
    }
    return true;
  }
  ll rho(ll n){
    if(is_prime(n)) return n;
    if(n % 2 == 0) return 2;
    ll c = 0;
    while(true){
      c = (3 * c + 1) % 24;
      auto f = [&](ll x){return(__int128_t(x)*x+c)%n;};
      ll st = 0;
      while(true){
        st++;
        ll x = st%n, y = f(x);
        while(true){
          ll g = gcd(abs(x-y), n);
          if(g==1) x = f(x), y = f(f(y));
          else if(g==n) break;
          else return g;
        }
      }
    }
  }
  vll factorize(ll n) {
    if(n == 1) return {};
    ll x = rho(n);
    if(x == n) return {x};
    vll le = factorize(x);
    vll ri = factorize(n / x);
    le.insert(le.end(), ri.begin(), ri.end());
    return le;
  }
}

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  vll a(n);re(i, n) scanf("%lld", &a[i]);
  map<ll, ll> m, z;
  re(i, n) for(ll j=2;j<=2500&&j*j*j<=a[i];j++) while(a[i]%(j*j*j)==0) a[i]/=(j*j*j);
  for(int i=0;i<n;i++){
    if(m.find(a[i])==m.end()) m.emplace(a[i], 1);
    else {
      ll t = m.at(a[i]);
      m.erase(a[i]);
      m.emplace(a[i], t+1);
    }
  }

  vll table;
  rep(i, 2, 100001){
    bool flag = true;
    for(ll j=2;j*j<=i;j++) if(i%j==0) flag = false;
    if(flag) table.push_back(i);
  }

  ll ans = 0;
  for(auto itr = m.begin();itr!=m.end();itr++){
    if((*itr).first==1) {
      ans++;
      continue;
    }
    if(z.find((*itr).first)!=z.end()) continue;
    ll now = (*itr).first, pat = 1;
    //-------------------------------------------------------------------
    vll t = fact::factorize(now);
    for(int j=0;j<t.size();j++){
      if(pat%t[j]!=0) pat *= t[j]*t[j];
      else pat/=t[j];
    }
    //-------------------------------------------------------------------
    if(m.find(pat)==m.end()) ans += (*itr).second;
    else{
      z.emplace((*itr).first, 0), z.emplace(pat, 0);
      ans += max((*itr).second, m.at(pat));
    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 7552