program main
  implicit none
  integer(8) :: n, i, res, r
  integer(8), allocatable :: a(:), left(:), right(:)
  read (*, *) n
  allocate (a(n), left(n), right(n))
  read (*, *) a(:)
  left(1) = a(1)
  do i = 2, n
    left(i) = gcd(left(i - 1), a(i))
  end do
  right(n) = a(n)
  do i = n - 1, 1, -1
    right(i) = gcd(right(i + 1), a(i))
  end do
  res = 1
  do i = 1, n
    if (i == 1) then
      r = right(2)
    else if (i == n) then
      r = left(n - 1)
    else
      r = gcd(left(i - 1), right(i + 1))
    end if
    res = max(res, r)
  end do
  write (*, "(i0)") res
  contains
  pure function gcd(x, y) result(a)
    integer(8), intent(in) :: x, y
    integer(8) :: a, b, r
    a = max(x, y)
    b = min(x, y)
    do while (b > 0)
      r = mod(a, b)
      a = b
      b = r
    end do
  end function gcd
end program main
