#include<stdio.h>
long int power(int n)
{
long int pro=1;
while(n)
{
pro = pro*5;
n--;
}
return pro;
}
int main()
{
int num=0;
long int arr[100000],t,temp,n,i,count=0;
scanf("%ld",&t);
temp = t;
while(t)
{
count=0;
num=1;
scanf("\n%ld",&n);
do
{
i = power(num);
if(i<n)
count= count+(n/i);
num++;
}while(i<n);
arr[temp-t]=count;
t--;
}
while(t<temp)
{
printf("%ld\n",arr[t++]);
}
return 0;
}