let pow x y =
  let rec f m n odd b = match n with
      0 -> 1
    | 1 -> m * odd
    | _ -> let t = if n mod 2 = 1 then odd * b else odd in
           f (m * m) (n/2) t (b * b)
  in f x y 1 x;;

let rec read () =
  let n = read_int () in
  if n != 0 then
    begin
      let rec f ct i =
        let d = n / (pow 5 i) in
        if d <= 0 then ct else f (d+ct) (i+1)
      in
      Printf.printf "%d\n" (f 0 1);
      read ()
    end
;;
let () = read ();;