#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int cnt_2;
int cnt_5;
void detach(int n)
{
while(n%2==0){
cnt_2++;
n /= 2;
}
while(n%5==0){
cnt_5++;
n /= 5;
}
}
int main()
{
freopen("a.txt","r",stdin);
for(int i = 0; i < 10*10; i++){
int n;
scanf("%d",&n);
detach(n);
}
cout << min(cnt_2,cnt_5);
fclose(stdin);
return 0;
}