Problem:
Score : 1100 points

Problem Statement

Snuke got positive integers s_1,...,s_N from his mother, as a birthday present. There may be duplicate elements.

He will circle some of these N integers. Since he dislikes cubic numbers, he wants to ensure that if both s_i and s_j (i ≠ j) are circled, the product s_is_j is not cubic. For example, when s_1=1,s_2=1,s_3=2,s_4=4, it is not possible to circle both s_1 and s_2 at the same time. It is not possible to circle both s_3 and s_4 at the same time, either.

Find the maximum number of integers that Snuke can circle.

Constraints

1 ≦ N ≦ 10^5

1 ≦ s_i ≦ 10^{10}

All input values are integers.

Input

The input is given from Standard Input in the following format:

N
s_1
:
s_N

Output

Print the maximum number of integers that Snuke can circle.

Sample Input 1

8
1
2
3
4
5
6
7
8

Sample Output 1

6

Snuke can circle 1,2,3,5,6,7.

Sample Input 2

6
2
4
8
16
32
64

Sample Output 2

3

Sample Input 3

10
1
10
100
1000000007
10000000000
1000000009
999999999
999
999
999

Sample Output 3

9

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#define _USE_MATH_DEFINES
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <math.h>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <numeric>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,ll> P;
 
int N;
 
ll S[100000];
ll prime[100000];
bool is_prime[100001];
 
map <ll, ll> mp;
map <ll,ll>::iterator it;
set <ll> st;

int sieve(int n){
  int p=0;
  for(int i=0; i<=n; i++) is_prime[i]=true;
  is_prime[0]=is_prime[1]=false;
  for(int i=2; i<=n; i++){
    if(is_prime[i]){
      prime[p++]=i;
      for(int j=2*i; j<=n; j+=i) is_prime[j]=false;
    }
  }
  return p;
}
 
ll dv(ll x){

  for(int i=0;; i++){

    ll q=prime[i];
    ll t=q*q*q;
    if(t>x) break;
    while(x%t==0){
      x/=t;
    }

  }

  return x;

}

ll tp(ll x){

  ll y=x*x; 

  for(int i=0;; i++){

    ll q=prime[i];
    ll t=q*q*q;

    if(t>y||q==0) break;

    while(y%t==0){
      y/=t;
    }

  }

  return y;

}
 
int main(){
 
 scanf("%d",&N);

 sieve(100000);
 
 for(int i=0; i<N; i++){

  scanf("%lld",&S[i]);
  ll x=dv(S[i]);
  mp[x]++;
 }

 int ans=0;
  
 for(it=mp.begin();it!=mp.end();it++){

  ll x=it->first; ll y=tp(x);

  if(st.count(y)) continue;

  if(x!=1) ans+=max(mp[x],mp[y]);
  else ans++;

  st.insert(x);

 }
  
  cout<<ans<<endl;
 
 return 0;
 
}