#include<stdio.h>
#define ll  long long
//#include<vector>
int main()
{
	int N=1000000;
	int p[1000001]={0};
	int v[1000001];
	p[2]=1;
        
		for(ll int i=3;i<=N;i+=2)
        p[i]=1;
        v[0]=2;
		ll int k=1;
        for(ll int i=3;i<=N;i+=2)
        {
            if(p[i])
            {
				v[k]=i;
				k++;
                for(ll int j=i*i;j<=N;j+=2*i)
                p[j]=0;
            }
        }
        //for(int i=0;i<v.size();i++)
        //cout<<v[i]<<" ";
       	int t;
        scanf("%d",&t);
        while(t--)
		{
		ll int n;
		scanf("%lld",&n);
		ll int i=0;
			ll int p1=v[0];
			ll int ans=1,d=0;
		while(p1*p1<=n&&i<k)
		{
				ll int c=0;
				while(n%p1==0)
				{
				n/=p1;
				c++;
				}
				if(c>0)
				d++;
				ans*=(c+1);
				i++;
				p1=v[i];			
		}
		if(n!=1)
		{
			ans*=2;
			ans-=1;
		}
		printf("%lld\n",ans-d);
 
		
	}
	return 0;
}
Language: C