```
// http://www.geeksforgeeks.org/count-trailing-zeroes-factorial-number
// the result is equal to count total number of 5s in prime factors of n!
int trailingZeroes(int n) {
int ans = 0;
for (int i = 5; n >= i; i *= 5) {
ans += n / i;
}
return ans;
}
```