#include <iostream>
using namespace std;

int judge(int num){
	int count = 0;
	int n = 5;
	while(n < num){
		count += num / n;
		n = n * 5;
	}
	return count;
}

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; i++){
		int num;
		cin >> num;
		cout << judge(num) << endl;
	}
	return 0;
}