//Factrial ?
#include<bits/stdc++.h>
using namespace std;

int solve(int a){
  int ret=0;
  for(int i=5; i<=a; i*=5){
    ret+=a/i;
  }
  return ret;
}

int main(){
  int n;
  cin>>n;
  while(n--){
    int a;
    cin>>a;
    cout<<solve(a)<<endl;
  }
  return 0;
}