#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int read(){
int ans=0,f=1,c=getchar();
while(c<'0'||c>'9'){if(c=='0') f=-1; c=getchar();}
while(c>='0'&&c<='9'){ans=ans*10+(c-'0'); c=getchar();}
return ans*f;
}
int T,n,ans;
int main()
{
T=read();
while(T--){
n=read()-1;
ans=0;
for(int i=1;i*i<=n;i++){
if(n%i==0){
if(n/i==i) ans++;
else ans+=2;
}
}
printf("%d\n",ans);
}
return 0;
}