import java.io.IOException;
import java.util.*;
class Main {
public static void main(String[] args) throws IOException
{
try
{
Scanner obj=new Scanner(System.in);
int t=obj.nextInt();
call(t);
}
catch(Exception e)
{
return;
}
}
static void call(int m)
{
int sum=0;
Scanner obj1=new Scanner(System.in);
int a[] = new int[m];
for(int j=0;j<a.length;j++)
{
a[j]=obj1.nextInt();
}
for( int j=0;j<a.length;j++)
{
sum=0;
int z=a[j];
while(z>=5)
{
sum = sum + (z/5);
z=z/5;
}
System.out.println(sum);
}
}
}