program abc125c
  implicit none
  integer(8) n, i
  integer(8),dimension(:),allocatable :: a, lgcd, rgcd
  read *, n
  allocate(a(n),lgcd(n+1),rgcd(n+1))
  read *, a
  lgcd = 0
  rgcd = 0
  do i = 1,n
     lgcd(i+1) = gcd(lgcd(i),a(i))
     rgcd(n-i+1) = gcd(rgcd(n-i+2),a(n-i+1))
  end do
  print *, maxval(gcd([0_8,lgcd],[rgcd,0_8]))
contains
  elemental function gcd(a,b) result(r)
    integer(8),intent(in) :: a, b
    integer(8) r, t, n
    n = a
    r = b
    do while (n /= 0)
       t = n
       n = mod(r,n)
       r = t
    end do
  end function gcd
end program abc125c
