import qualified Data.IntSet as S

main = do
  li <- getLine
  let x = read li
  let ans = compute x
  print ans

compute :: Int -> Int
compute x = loop x 0 (S.singleton 0)

loop x c s
  | S.member x s = c
  | True = loop x (succ c) (s `S.union` (S.map (x +) s) `S.union` (S.map (subtract x) s))
