let id x = x

let rec fact2 n = 
  let m = n / 5 in
  if m = 0 then 0
  else m + fact2 m

let _ = 
  let rec loop () = 
    let n = Scanf.scanf "%d\n" id in
    if n = 0 then ()
    else
      begin
        Printf.printf "%d\n" (fact2 n);
        loop ()
      end
  in loop ()