```
class Solution {
public:
int trailingZeroes(int n) {
int limit = int(log(n)/log(5));
int count = 0;
int i;
for(i = 1;i<=limit;i++)
count = count+n/pow(5,i);
return count;
}
};
```

The reason is that one 2 and one 5 together contribute a 10 (trailing zero), and that 2's are much more than 5's. Thus counting 5's is sufficient.