implicit none
integer n,i,k,gcdmin,min1,min2
integer,allocatable,dimension(:)::a

read(5,*)n
allocate(a(n))
read(5,*)(a(i),i=1,n)

gcdmin=a(1)
min1=min(a(1),a(2))
min2=max(a(1),a(2))

do k=1,n,2
gcdmin=gcd(gcd(max(a(k),a(k+1)),min(a(k),a(k+1))),gcdmin)

if(gcdmin.lt.min2)then
 min2=gcdmin
endif

if(gcdmin.lt.min1)then
 min2=min1
 min1=gcdmin
endif

enddo

write(6,*) min2

contains
 recursive function gcd(a,b) result(res)
  implicit none
  integer,intent(in) :: a, b
  integer r, res,t
   
   
  r = mod(a,b)
  if(r == 0) then
    res = b
  else
    res = gcd(b,r)
  endif
end function gcd


end