import qualified Data.ByteString.Char8 as C
import Data.List
import Data.Ord

main = C.interact $ put . sol . get

get = unfoldr (C.readInt . C.dropWhile (<'0'))

put = C.pack . show

sol (x:_:ps) = minimumBy (comparing ev) $ filter (`notElem` ps) [-101..101]
  where
  ev i = (abs(i-x), i)