// Shashank Jain
#include<iostream>
#include<cstdio>
#define LL long long int
using namespace std;
LL n;
LL power(LL num)
{
LL sum=0,m,temp;
m=n;
while(m>0)
{
temp=m/num;
sum+=temp;
m/=num;
}
return sum;
}
int main()
{
int t;
LL k1,k2,ans;
scanf("%d",&t);
while(t--)
{
scanf("%lld",&n);
k1=power(2);
k2=power(5);
ans=min(k1,k2);
printf("%lld\n",ans);
}
return 0;
}
// Voila
Ly8gU2hhc2hhbmsgSmFpbgojaW5jbHVkZTxpb3N0cmVhbT4KI2luY2x1ZGU8Y3N0ZGlvPgojZGVmaW5lIExMIGxvbmcgbG9uZyBpbnQKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKTEwgbjsKTEwgcG93ZXIoTEwgbnVtKQp7CglMTCBzdW09MCxtLHRlbXA7CgltPW47Cgl3aGlsZShtPjApCgl7CgkJdGVtcD1tL251bTsKCQlzdW0rPXRlbXA7CgkJbS89bnVtOwoJfQoJcmV0dXJuIHN1bTsKfQppbnQgbWFpbigpCnsKCWludCB0OwoJTEwgazEsazIsYW5zOwoJc2NhbmYoIiVkIiwmdCk7Cgl3aGlsZSh0LS0pCgl7CgkJc2NhbmYoIiVsbGQiLCZuKTsKCQlrMT1wb3dlcigyKTsKCQlrMj1wb3dlcig1KTsKICAgICAgICAgYW5zPW1pbihrMSxrMik7CgkJcHJpbnRmKCIlbGxkXG4iLGFucyk7CQoJfQoJcmV0dXJuIDA7Cn0KLy8gVm9pbGE=