while str = gets do
  num = str.chomp.to_i
  break if num == 0
  n2 = 0
  n5 = 0
  (1..num).each do |n|
    nn = n
    while nn % 2 == 0
      n2 += 1
      nn /= 2
    end
    nn = n
    while nn % 5 == 0
      n5 += 1
      nn /= 5
    end
  end
  puts [n2, n5].min
end