main=do
 n<-readLn;a<-map read.words<$>getLine
 print((maximum.map(\(a,b)->if(a==0||b==0)then(max a b)else(gcd a b)))(zip(reverse(f n (reverse a) 0))(f n a 0)))
  where f 0 _ _ =[]
        f n (b:a) 0 =0:(f(n-1)a b)
        f n (b:a) g =g:(f(n-1)a(gcd g b))