program gcd_on_blackboard
  implicit none
  integer :: n, a(100000), i, g, m
  integer :: l(0:100000), r(1:100001)
  a = 0
  l = 0
  r = 0
  read(*,*) n
  read(*,*) a(1:n)
  m = 1
  do i = 1, n
    l(i) = gcd(l(i-1),a(i-1))
  end do
  do i = n, 1, -1
    r(i) = gcd(r(i+1),a(i))
  end do
  do i = 1, n
    g = gcd(l(i),r(i+1))
    if (m.lt.g) m = g
  end do
  write(*,'(i0)') m
  stop
contains
  recursive function gcd(n,m) result(g)
    implicit none
    integer, intent(in) :: n, m
    integer :: g
    if (n.eq.0) then
      g = m
    else if (m.eq.0) then
      g = n
    else if (n.lt.m) then
      g = gcd(m,n)
    else if (mod(n,m).eq.0) then
      g = m
    else
      g = gcd(m,mod(n,m))
    end if
  end function gcd
end program gcd_on_blackboard