let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n

let rec divisors acc i =
  if i * i > n then acc
  else if i * i = n then i :: acc
  else if n mod i = 0 then divisors (i :: (n / i) :: acc) (i + 1)
  else divisors acc (i + 1)
let divisors = divisors [] 1

let like i = i <> 0 && (n / i) = n mod i

let () = divisors
  |> List.map ((+) (-1))
  |> List.filter like
  |> List.fold_left (+) 0
  |> Printf.printf "%d\n"