while num = STDIN.gets.to_i
  count = 0
  data = Array.new
  if num == 0 then break end
  if num < 5
    puts 0
  else
    i = 1
    while TRUE
      data[i] = Array.new
      if num/5**i == 0 then break end
      for j in 1.. num/5**i
        data[i].push(5**i * j)
      end
      i += 1
    end
    sum = 0
    for i in 1.. data.length-1
      sum+= data[i].length
    end
  puts sum
  end
end