using System;
public class Test
{
public static void Main(string[] args)
{
int numberOfValues = int.Parse(Console.ReadLine());
int[] values = new int[numberOfValues];
for(int i=0;i<numberOfValues;i++)
{
values[i] = int.Parse(Console.ReadLine());
}
for (int i = 0; i < numberOfValues; i++)
{
Console.WriteLine(calculateFact(values[i]));
}
Console.ReadKey();
}
static int calculateFact(int value)
{
int finalValue = 0;
for (int i = 0; value > 5; i++)
{
value = value / 5;
finalValue += value;
}
return finalValue;
}
}
dXNpbmcgU3lzdGVtOwoKcHVibGljIGNsYXNzIFRlc3QKewoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oc3RyaW5nW10gYXJncykKICAgICAgICB7CiAgICAgICAgICAgIGludCBudW1iZXJPZlZhbHVlcyA9IGludC5QYXJzZShDb25zb2xlLlJlYWRMaW5lKCkpOwogICAgICAgICAgICBpbnRbXSB2YWx1ZXMgPSBuZXcgaW50W251bWJlck9mVmFsdWVzXTsKCiAgICAgICAgICAgIGZvcihpbnQgaT0wO2k8bnVtYmVyT2ZWYWx1ZXM7aSsrKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YWx1ZXNbaV0gPSBpbnQuUGFyc2UoQ29uc29sZS5SZWFkTGluZSgpKTsKICAgICAgICAgICAgfQoKICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW1iZXJPZlZhbHVlczsgaSsrKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZShjYWxjdWxhdGVGYWN0KHZhbHVlc1tpXSkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIENvbnNvbGUuUmVhZEtleSgpOwogICAgICAgIH0KCiAgICAgICAgc3RhdGljIGludCBjYWxjdWxhdGVGYWN0KGludCB2YWx1ZSkKICAgICAgICB7CiAgICAgICAgICAgIGludCBmaW5hbFZhbHVlID0gMDsKICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IHZhbHVlID4gNTsgaSsrKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB2YWx1ZSA9IHZhbHVlIC8gNTsKICAgICAgICAgICAgICAgIGZpbmFsVmFsdWUgKz0gdmFsdWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIGZpbmFsVmFsdWU7CiAgICAgICAgfQp9