N!에서 뒤에서부터 처음 0이 아닌 숫자가 나올 때까지 0의 개수를 구하는 프로그램을 작성하시오.
첫째 줄에 N이 주어진다. (0 ≤ N ≤ 500)
첫째 줄에 구한 0의 개수를 출력한다.
10
2
3
0
import sys
n = int(sys.stdin.readline())
two = 0; five = 0
for i in range(2, n + 1):
if i % 2 == 0:
temp = i
while True:
if temp % 2 != 0:
break
temp //= 2
two += 1
if i % 5 == 0:
temp = i
while True:
if temp % 5 != 0:
break
temp //= 5
five += 1
print(min(two, five))