readDigits :: IO [Int] readDigits = map read <$> words <$> getLine main :: IO () main = do ns <- readDigits let (x,_) = head $ filter (\(a,b) -> a/=b) $ zip [1..] ns putStrLn . show $ x