import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int t;
int count = 0;
int n;
Scanner input = new Scanner(System.in);
t = input.nextInt();
int inc=1;
int[] array = new int[t];
for (int i = 0; i< array.length;i++){
n =input.nextInt();
count = 0;
inc=1;
while(n/Math.pow(5,inc)>=1){
count+=n/Math.pow(5,inc);
inc ++;
}array[i]=count;
}
for(int i=0;i<array.length;i++){
System.out.println(array[i]);
}
}
}