#include <bits/stdc++.h>

/***********************************************************/

const int MIKI = 0;

const int DIM = 3e3;

const int NMAX = 1e5;
const int MMAX = 1e5;
const int HMAX = 1e5;
const int LMAX = 1e5;

const int MOD = 1e9 + 7;

const int HMOD1 = 1e9 + 7;
const int HMOD2 = 1e9 + 9;
const int HCNS1 = 2e1 + 9;
const int HCNS2 = 3e1 + 1;

const double DEPS  = 1e-7;
const double LDEPS = 1e-11;

/***********************************************************/

typedef bool b1;

typedef char      i8;
typedef short     i16;
typedef int       i32;
typedef long long i64;

typedef signed char      s8;
typedef signed short     s16;
typedef signed int       s32;
typedef signed long long s64;

typedef unsigned char      u08;
typedef unsigned short     u16;
typedef unsigned int       u32;
typedef unsigned long long u64;

typedef float       f32;
typedef double      f64;
typedef long double f128;

/***********************************************************/

typedef std::pair<bool, bool>               pbb;
typedef std::pair<char, char>               pcc;
typedef std::pair<short, short>             pss;
typedef std::pair<int, int>                 pii;
typedef std::pair<long long, long long>     pll;
typedef std::pair<float, float>             pff;
typedef std::pair<double, double>           pdd;
typedef std::pair<long double, long double> poo;

typedef std::tuple<bool, bool, bool>                      pbbb;
typedef std::tuple<char, char, char>                      pccc;
typedef std::tuple<short, short, short>                   psss;
typedef std::tuple<int, int, int>                         piii;
typedef std::tuple<long long, long long, long long>       plll;
typedef std::tuple<float, float, float>                   pfff;
typedef std::tuple<double, double, double>                pddd;
typedef std::tuple<long double, long double, long double> pooo;

typedef std::vector<bool>        vb;
typedef std::vector<char>        vc;
typedef std::vector<short>       vs;
typedef std::vector<int>         vi;
typedef std::vector<long long>   vl;
typedef std::vector<float>       vf;
typedef std::vector<double>      vd;
typedef std::vector<long double> vo;

typedef std::vector<std::pair<bool, bool>>               vbb;
typedef std::vector<std::pair<char, char>>               vcc;
typedef std::vector<std::pair<short, short>>             vss;
typedef std::vector<std::pair<int, int>>                 vii;
typedef std::vector<std::pair<long long, long long>>     vll;
typedef std::vector<std::pair<float, float>>             vff;
typedef std::vector<std::pair<double, double>>           vdd;
typedef std::vector<std::pair<long double, long double>> voo;

typedef std::vector<std::tuple<bool, bool, bool>>                      vbbb;
typedef std::vector<std::tuple<char, char, char>>                      vccc;
typedef std::vector<std::tuple<short, short, short>>                   vsss;
typedef std::vector<std::tuple<int, int, int>>                         viii;
typedef std::vector<std::tuple<long long, long long, long long>>       vlll;
typedef std::vector<std::tuple<float, float, float>>                   vfff;
typedef std::vector<std::tuple<double, double, double>>                vddd;
typedef std::vector<std::tuple<long double, long double, long double>> vooo;

typedef std::string              sr;
typedef std::vector<std::string> vsr;

/***********************************************************/

template <typename type1, typename type2>
std::ostream& operator << ( std::ostream& out, const std::pair<type1, type2> &pr ) {
    return out << pr.first << " " << pr.second; }

template <typename type>
std::ostream& operator << ( std::ostream& out, const std::vector<type> &arr ) {
    for( auto& x : arr ) out << x << " "; return out; }

/***********************************************************/

template <typename type>
type min( type x ) {
    return x;
}

template <typename type, typename... args>
type min( type x, args... y ) {
    return std::min( x, min(y...) );
}

template <typename type>
type max( type x ) {
    return x;
}

template <typename type, typename... args>
type max( type x, args... y ) {
    return std::max( x, max(y...) );
}

template <typename type>
type gcd( type a, type b ) {
    return !b ? a : gcd( b, a % b );
}

/***********************************************************/

#define fe pop_front
#define be pop_back

#define fi push_front
#define bi push_back

#define mp make_pair
#define mt make_tuple

#define efor( i, arr )     for( auto &i : arr )
#define afor( i, x, y )    for( auto i = (x); i <= (y); ++ i )
#define dfor( i, x, y )    for( auto i = (x); i >= (y); -- i )
#define ffor( i, x, y, z ) for( auto i = (x); i <= (y); i += (z) )
#define bfor( i, x, y, z ) for( auto i = (x); i >= (y); i -= (z) )

#define fastcall __attribute__ (( optimize("-O3") ))
#define inline __inline__ __attribute__ (( always_inline ))

/***********************************************************/

using namespace std;

/***********************************************************/

vl pri;
bitset<DIM + 1> oki;

unordered_map<long long, long long> mmp1, mmp2;

inline void solve( i64 x ) {
    i64 num1 = 1, num2 = 1;
    
    efor( y, pri ) {
        i32 cnt = 0;
        
        while( x % y == 0 ) {
            cnt ++;
            x /= y;
        }
        
        cnt %= 3;
        if( cnt != 0 ) {
            if( cnt == 1 ) {
                num1 *= y;
                num2 *= y * y;
            } else {
                num1 *= y * y;
                num2 *= y;
            }
        }
    }
    
    if( x != 1 ) {
        i64 y = sqrt( x );
        
        if( y * y == x ) {
            num1 *= y * y;
            num2 *= y;
        } else {
            num1 *= x;
            num2 *= x * x;
        }
    }
    
    mmp1[num1] ++;
    mmp2[num1] = num2;
    
    return;
}

i32 main( void ) {
    ios::sync_with_stdio( false );
    cin.tie( 0 ); cout.tie( 0 );
    
    afor( i, 2, DIM ) {
        if( oki[i] == false ) {
            pri.push_back( i );
            
            ffor( j, i + i, DIM, i )
                oki[j] = true;
        }
    }
    
    i32 n;
    cin >> n;
    
    afor( i, 1, n ) {
        i64 x;
        cin >> x;
        
        solve( x );
    }
    
    i64 sol = 0;
    efor( pr, mmp1 ) {
        i64 ans = pr.second;
        
        if( mmp1.find( mmp2[pr.first] ) != mmp1.end() ) {
            ans = max( ans, mmp1[mmp2[pr.first]] );
            mmp1[mmp2[pr.first]] = mmp1[pr.first] = 0;
        }
        
        if( pr.first == mmp2[pr.first] )
            ans = 1;
        
        sol += ans;
    }
    
    cout << sol;
    return MIKI;
}

Measured memory_bytes: 9288