def gcd(a,b):

  while b:a,b=b,a%b

  return a

n=int(eval(input()))

a=list(map(int,input().split()))

if n==2:print((max(a[0],a[1])));exit()

left=[a[0]]

for i in range(1,n):left.append(gcd(left[-1],a[i]))

right=[a[n-1]]

for i in range(n-2,-1,-1):right.append(gcd(right[-1],a[i]))

right.reverse()

ans=max(right[1],left[n-2])

print((max(ans,max(gcd(left[i-1],right[i+1])for i in range(1,n-1)))))
def gcd(a,b):

  while b:a,b=b,a%b

  return a

n,a=int(eval(input())),list(map(int,input().split()))

if n==2:print((max(a)));exit()

if n==3:print((max(gcd(a[0],a[1]),gcd(a[0],a[2]),gcd(a[1],a[2]))));exit()

ans=ans2=a[0]

for i in range(1,n):

  g=gcd(ans,a[i])

  if g!=ans:

    ans=max(g,ans2)

    ans2=gcd(g,ans2)

print(ans)
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


n = int(eval(input()))
a = list(map(int, input().split()))
if n == 2:
    print((max(a[0], a[1])))
    exit()
left = [a[0]]
for i in range(1, n):
    left.append(gcd(left[-1], a[i]))
right = [a[n - 1]]
for i in range(n - 2, -1, -1):
    right.append(gcd(right[-1], a[i]))
right.reverse()
ans = max(right[1], left[n - 2])
print((max(ans, max(gcd(left[i - 1], right[i + 1]) for i in range(1, n - 1)))))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


n, a = int(eval(input())), list(map(int, input().split()))
if n == 2:
    print((max(a)))
    exit()
if n == 3:
    print((max(gcd(a[0], a[1]), gcd(a[0], a[2]), gcd(a[1], a[2]))))
    exit()
ans = ans2 = a[0]
for i in range(1, n):
    g = gcd(ans, a[i])
    if g != ans:
        ans = max(g, ans2)
        ans2 = gcd(g, ans2)
print(ans)

-n = int(eval(input())) -a = list(map(int, input().split())) +n, a = int(eval(input())), list(map(int, input().split())) -    print((max(a[0], a[1]))) +    print((max(a))) -left = [a[0]] +if n == 3: +    print((max(gcd(a[0], a[1]), gcd(a[0], a[2]), gcd(a[1], a[2])))) +    exit() +ans = ans2 = a[0] -    left.append(gcd(left[-1], a[i])) -right = [a[n - 1]] -for i in range(n - 2, -1, -1): -    right.append(gcd(right[-1], a[i])) -right.reverse() -ans = max(right[1], left[n - 2]) -print((max(ans, max(gcd(left[i - 1], right[i + 1]) for i in range(1, n - 1))))) +    g = gcd(ans, a[i]) +    if g != ans: +        ans = max(g, ans2) +        ans2 = gcd(g, ans2) +print(ans)