import Control.Arrow
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as V
main=print.solve.V.unfoldr(B.readInt.B.dropWhile isSpace)=<<(B.getLine>>B.getLine)
solve=V.maximum.uncurry(V.zipWith gcd).(V.scanl gcd 0&&&V.tail.V.scanr gcd 0)