```
class Solution:
# @return an integer
def trailingZeroes(self, n):
div = 5
result = 0
while div <= n:
result += n//div
div = div*5
return result
```

Updated Version with additional checking for overflow. Thanks to @adamlhh for pointing this out!

```
class Solution:
# @return an integer
def trailingZeroes(self, n):
div = 5
result = 0
while div <= n:
result += n//div
if div > (0x7FFFFFFF/5):
break
div = div*5
return result
```