program abc125c
  implicit none
  integer(8) n, i
  integer(8), dimension(:), allocatable :: a, lgcd, rgcd, ans
  read *, n
  allocate(a(n), lgcd(n + 2), rgcd(n + 2))
  read *, a
  lgcd = 0
  rgcd = 0
  do i = 1, n
     lgcd(i + 2) = gcd(lgcd(i + 1), a(i))
     rgcd(n - i + 1) = gcd(rgcd(n - i + 2), a(n - i + 1))
  end do
  ans = gcd(lgcd, rgcd)
  print *, maxval(ans(3:n))
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
