Language: C++

#include<bits/stdc++.h>
using namespace std;
#define IL inline
#define rep(i,j,k) for(int i=j;i<=k;++i)
#define repd(i,j,k) for(int i=j;i>=k;--i)
#define pb push_back
#define db double
#define mp make_pair
#define mp3(a,b,c) mp(mp(a,b),c)
#define pii pair<int,int>
#define piii pair<pii,int>
#define fr first
#define se second
#define ll long long
#define ull unsigned long long
#define pbc(x) __builtin_popcount(x)
#define clr(x) memset(x,0,sizeof x)
#define SIZE(x) (int)(x.size())
int mod;
IL int pls(int x,int y){x+=y;return x>=mod?x-mod:x;}
IL int dec(int x,int y){x-=y;return x<0?x+mod:x;}
IL ll mul(ll x,ll y){return (__int128)*x*y%mod;}
IL ll mul(ll x,ll y,ll z){return mul(mul(x,y),z);}
IL ll mul(ll x,ll y,ll z,ll p){return mul(mul(x,y),mul(z,p));}
IL void add(int &x,int y){x+=y;x=(x>=mod)?x-mod:x;}
IL ll fpw(ll x,ll y,ll r=1){for(;y;y>>=1,x=mul(x,x))if(y&1)r=mul(r,x);return r;}
IL int inv(int x){return fpw(x,mod-2);}
IL int gi(){int x;int _w=scanf("%d",&x);return x;}
IL void gi(int &x){int _w=scanf("%d",&x);}
IL void write(int x){printf("%d\n",x);}
void chkmax(int &x,int y){x=(x>y)?x:y;}
void chkmin(int &x,int y){x=(x<y)?x:y;}
const int INF=0x3f3f3f3f;
template<typename T>IL void debug(T x){cerr<<x;return;}
/* --------------------------------------------------------------------------------------------------------- */
template<typename T>T read(){
	char ch;T u=0,f=1;
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){u=(u<<1)+(u<<3)+ch-48;ch=getchar();}
	return u*f;
}
namespace Rho{
	const int pri[]={2,3,5,7,11,13,17,19,23,29,31,37};
	IL bool Miller_Rabin(ll n){
		mod=n;
		rep(i,0,11)if(n%pri[i]==0)return n==pri[i];
		int r,t;
		for(r=n-1,t=0;~r&1;r>>=1,++t);
		rep(i,0,11){
			ll x=fpw(pri[i],r);
			for(int j=0;j<t&&x>1;++j){
				ll y=mul(x,x);
				if(y==1&&x!=n-1)return false;
				x=y;
			}
			if(x!=1)return false;
		}
		return true;
	}
	IL ll gcd(ll x, ll y){return !y?x:gcd(y,x%y);}
	IL ll func(ll x, ll a){return pls(mul(x,x),a);}
	IL ll Find(ll n){
		rep(i,0,11)if(n%pri[i]==0)return pri[i];
		ll a=rand();
		ll x=func(rand(),a),y=x;
		do{
			ll g=gcd(dec(x,y),n);
			if(g!=1&&g!=n)return g;
			x=func(x,a);y=func(func(y,a),a);
		}while(x!=y);
		return -1;
	}
	IL void Pollard_Rho(ll n,vector<ll>&D){
		if(n==1||Miller_Rabin(n)){if(n!=1)D.pb(n);return;}
		ll d=-1;while(d==-1)d=Find(n);
		Pollard_Rho(d,D);Pollard_Rho(n/d,D);
	}
}
map<ll,int>num,rev,vis;
ll Fpw(ll x,ll y,ll r=1ll){for(;y;y>>=1,x=x*x)if(y&1)r=r*x;return r;}
int main(){
#ifdef LOCAL
	freopen("/home/noilinux/Desktop/input.txt","r",stdin);
#endif
	int n=gi();
	rep(i,1,n){
		ll ai=read<ll>();
		if(ai==1){rev[1]=1;num[1]++;continue;}
		vector<ll>D;sort(D.begin(),D.end());
		Rho::Pollard_Rho(ai,D);
		sort(D.begin(),D.end());
		int l=1,val=D[0];ll X=1,Y=1;
		for(int i=1;i<D.size();++i){
			if(D[i]==val){l++;continue;}
			else {
				X=X*Fpw(val,l%3);
				Y=Y*Fpw(val,(3-l%3)%3);
				val=D[i];l=1;
			}
		}if(l){
			X=X*Fpw(val,l%3);
			Y=Y*Fpw(val,(3-l%3)%3);
		}rev[X]=Y;rev[Y]=X;num[X]++;
	}
	int ans=0;
	for(auto v:num){
		if(vis[v.fr])continue;
		if(v.fr==1)ans++;
		else ans+=max(v.se,num[rev[v.fr]]),vis[v.fr]=vis[rev[v.fr]]=1;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'long long int mul(long long int, long long int)':
a.cc:22:39: error: invalid type argument of unary '*' (have 'long long int')
   22 | IL ll mul(ll x,ll y){return (__int128)*x*y%mod;}
      |                                       ^~