#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
const int Factor= 1000;
int zeros[Factor] = {1, 0};
int a[2568] = {1}; //1000!2568位
void proc()
{
double bitNum = 1.0; //n!阶乘的位数
int beg = 0; //(n-1)!阶乘0的个数
int e;
for (int n = 2; n <= Factor; ++n)
{
e = (bitNum += log10(1.0 * n));
while (a[beg] == 0)
{
++beg;
}
int temp = 0;;
for (int j = beg; j < e; ++j)
{
temp = a[j] * n + temp;
a[j] = temp % 10;
temp /= 10;
}
zeros[n] = count(a + beg, a + e, 0) + beg;
}
}
int main(int argc, char *argv[])
{
proc();
for (int i = 0; i < 10; ++i)
{
cout << i << "! :" << zeros[i] << endl;
}
return 0;
}