{-# LANGUAGE Strict #-}
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = B.interact
  $ B.pack
  . show
  . solve
  . map (maybe (error "parse error") fst . B.readInt)
  . B.words

solve :: [Int] -> Int
solve (n:as) = sum as - n
