#include<cstdio>
int mod[]={5,25,125,625,3125,15625,78125,390625,1953125,9765625,48828125,244140625,1220703125};
int main(){
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
int t;scanf("%d",&t);
int fac;
while(t--){
scanf("%d",&fac);
int ans=0;
for(int i=0;mod[i]<fac;++i)ans+=fac/mod[i];
printf("%d\n",ans);
}
fclose(stdin);fclose(stdout);
return 0;
}