#The solution in Python 3 is as follows:
def count (x): #function to count the no. of trailing zeros
i = 5
zeros = 0
while x >= i:
zeros += x // i
i *= 5
return zeros
t=int(input()) #No. of test cases
j=0
while j<t:
a=int(input())
print(count(a))
j+=1
#Visit this link for more info.
#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!
def count (x): #function to count the no. of trailing zeros
i = 5
zeros = 0
while x >= i:
zeros += x // i
i *= 5
return zeros
t=int(input()) #No. of test cases
j=0
while j<t:
a=int(input())
print(count(a))
j+=1
#Visit this link for more info.
#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!