let rec upper_bound l r p =
  if r <= 1 + l
  then l
  else let m = (l + r) / 2 in
       if p m 
       then upper_bound m r p
       else upper_bound l m p

let () = Scanf.scanf "%d\n" @@ fun x ->
  Printf.printf "%d\n" @@ upper_bound 0 (abs x + 1) @@ fun i -> i * (i - 1) / 2 < abs x
