#include<bits/stdc++.h>
#define int long long
using namespace std;
bool check(int n){
for(int i=2;i*i<=n;i++){
if(n%i==0){
return false;
}
}
return true;
}
signed main(){
int t;
cin>>t;
while(t--){
int n,ans=0;
cin>>n;
for(int i=2;i*i*i<=n;i++){
if(check(i)){
int x=i*i*i;
while(n%x==0){
n/=x;
ans++;
}
}
}
cout<<ans<<endl;
}
}