# frozen_string_literal: true

loop do
  n = gets.to_i
  break if n == 0

  s2 = 0
  s5 = 0
  m = n
  while m > 0
    m /= 2
    s2 += m
  end
  m = n
  while m > 0
    m /= 5
    s5 += m
  end
  puts s5 < s2 ? s5 : s2
end

