import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import Text.Printf
import Debug.Trace

solve x = sub x 1
  where
    sub x i
      | x <= i = i
      | otherwise = sub (x-i) (i+1)

main = do
  [x] <- getInts
  print $ solve x


-- util
getInts :: IO [Integer]
getInts = map (fst . fromJust . B.readInteger) . B.words <$> B.getLine

