#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

int nextInt()
{
    int y = 0;
    char c = getchar();
    while ('0' <= c && c <= '9')
    {
        y = 10 * y + c - '0';
        c = getchar();
    }
    return y;
}

long long max(long long a, long long b)
{
    if (a > b) return a;
    return b;
}

long long min(long long a, long long b)
{
    if (a < b) return a;
    return b;
}

unsigned long long n;
unsigned long long a[500000];
unsigned long long b[500000];
unsigned long long paired[500000];
const unsigned long long INF = 1e10;

unsigned long long My_sqrt(unsigned long long x)
{
    long long y = sqrt(x);
    while (y * y < x) y++;
    while (y * y > x) y--;
    if (y * y == x) return y;
    return -1;
}

map<unsigned long long, int> cnt;

signed main()
{
    //freopen("", "r", stdin);
    //freopen("", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        for (ll j = 2; j * j * j <= INF; j++)
        {
            while (a[i] % (j * j * j) == 0)
            {
                a[i] /= j * j * j;
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        paired[i] = 1;
        b[i] = 1;
        for (ll j = 2; j * j * j <= INF; j++)
        {
            int cnt = 0;
            while (a[i] % j == 0)
            {
                a[i] /= j;
                cnt++;
                b[i] *= j;
            }
            cnt = (3 - cnt) % 3;
            while (cnt > 0)
            {
                paired[i] *= j;
                cnt--;
            }
        }
    }
    long long ans = 0;
    for (int i = 0; i < n; i++)
    {
        ll x = My_sqrt(a[i]);
        if (x == -1)
        {
            paired[i] *= a[i] * a[i];
        }
        else
        {
            paired[i] *= x;
        }
    }
    for (int i = 0; i < n; i++)
    {
        cnt[a[i] * b[i]]++;
    }
    int t = 0;
    for (int i = 0; i < n; i++)
    {
        if (a[i] * b[i] == 1) t = 1;
        else
        {
            ans += max(cnt[a[i] * b[i]], cnt[paired[i]]);
            cnt[a[i] * b[i]] = 0;
            cnt[paired[i]] = 0;
        }
    }
    cout << ans + t;
}


Measured memory_bytes: 21888