#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int main() {
	// your code goes here
	int a, b, c;
	cin>>a;
	while(a--) {
		cin>>b;
		c=0;
		for (int i=1; pow(5, i)<=b; i++) {
			c=c+b/pow(5, i);
			//i++;
		}
		cout<<c<<endl;
	}
	return 0;
}