#include
using namespace std;
int main(){
int n;
cin>>n;
int *p=new int;
for(int i=0;i<n;i++){
cin>>p[i];
}
for(int i=0;i<n;i++){
int c=0;//count initialized
for(int j=5;p[i]/j>=1;j*=5){
c+=p[i]/j;
}
cout<<c<<endl;
}
return 0;
}
// the code is showing runtime error. why? how to get rid of it?