import qualified Data.ByteString.Char8 as C
import qualified Data.IntSet as S
import Data.Ix
import Data.List
import Data.Maybe

main = C.interact $ put . sol . get

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

put = C.pack . show

sol (x:_:ps) = fromMaybe x $ find (`S.notMember` s) qs 
  where
  qs = filter (inRange (1,100)) . map (+x) $ 0:concatMap (\i -> [-i,i]) [1..99]
  s = S.fromList ps