#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, tc, ans;
cin>>tc;
while(tc--)
{
cin>>n;
ans=0;
while(n)
{
n/=5;
ans+=n;
}
cout<<ans<<endl;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkKewogICAgaW50IG4sIHRjLCBhbnM7CiAgICBjaW4+PnRjOwogICAgd2hpbGUodGMtLSkKICAgIHsKICAgICAgICBjaW4+Pm47CiAgICAgICAgYW5zPTA7CiAgICAgICAgd2hpbGUobikKICAgICAgICB7CiAgICAgICAgICAgIG4vPTU7CiAgICAgICAgICAgIGFucys9bjsKICAgICAgICB9CiAgICAgICAgY291dDw8YW5zPDxlbmRsOwogICAgfQogICAgcmV0dXJuIDA7Cn0KCg==