while true
  n = gets.chomp.to_i
  break if n == 0

  n2 = 0
  n5 = 0

  for k in (2..n)
    while k % 2 == 0
      n2 += 1
      k /= 2
    end
    while k % 5 == 0
      n5 += 1
      k /= 5
    end
  end

  n10 = [n2, n5].min
  puts n10
end