N = gets.to_i
A = gets.split.map(&:to_i)

def gcd(left, right)
  return A[left] if left == right
  return A[left].gcd(A[right]) if left + 1 == right

  mid = (left + right)/2
  x = gcd(left, mid)
  return 1 if x==1
  y = gcd(mid, right)
  return 1 if y==1
  return x.gcd(y)
end

max = 1

for i in 0..N-1 do
  if i == 0
    tmp = gcd(1,N-1)
  elsif i == N-1
    tmp = gcd(0,N-2)
  else
    x = gcd(0,i-1)
    y = gcd(i+1,N-1)
    tmp = x.gcd(y)
  end

  max = tmp if max < tmp
end

puts max
