program main
  implicit none
  integer(8) :: i, j, n, result = 0
  integer(8), allocatable :: a(:), l(:), r(:)

  read *, n
  allocate (a(n), l(0:n), r(n+1))
  read *, a

  l(0) = 0
  l(1) = a(1)
  r(n+1) = 0
  r(n) = a(n)
  do i = 2, n
    l(i) = euclid(l(i-1), a(i))
    r(n+1-i) = euclid(r(n+2-i), a(n+1-i))
  end do

  do i = 1, n
    result  = max(euclid(l(i-1), r(i+1)), result)
  end do

  print '(i0)', result

contains
  function euclid(a, b) result (res)
    integer(8) :: a, b, u, v, res
    u = a; v = b
    do while(v /= 0)
      res = mod(u, v)
      u = v
      v = res
    end do
    res = u
  end function
end program