module Main where

toInt :: String -> Int
toInt s = read s :: Int

strToIntList :: String -> [Int]
strToIntList = map toInt . words

getIntList :: IO [Int]
getIntList = getLine >>= return . strToIntList

main :: IO ()
main = do
  getLine 
  ab <- getIntList
  print . truncate . logBase 2 . fromIntegral $ foldl gcd 0 ab