program ccc
implicit none

integer(8) :: n, i, one, two, g, res1, res2
integer(8),dimension(1) :: l
integer(8),allocatable,dimension(:) :: a, gg

read*, n
allocate(a(n))
allocate(gg(n))
read*, a

one=a(1)
gg(1)=one
do i=2,n
one=a(1)
two=a(i)
call gcd(one,two,g)
gg(i)=g
end do

l=minloc(gg)
gg(l)=one
l=minloc(gg)
res1=gg(l(1))

one=(a(2))
gg(1)=a(2)
do i=2,n
one=a(2)
two=a(i)
call gcd(one,two,g)
gg(i)=g
end do

l=minloc(gg)
res2=gg(l(1))

write(*,'(i0)') max(res1,res2)

end program

subroutine gcd(a,b,ans)
integer(8) :: a, b, aa, bb, m, ans

aa=max(a,b)
bb=min(a,b)
a=aa
b=bb
m=1
do while(m/=0)
 m=mod(a,b)
 a=b
 b=m
end do
ans=a
end subroutine gcd