import sys

sys.setrecursionlimit(10**7)

input = sys.stdin.readline

INF = float('inf')

MOD = 10**9+7



n = int(eval(input()))

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

ass = set()

def div(x):

    for i in range(1,int(x**0.5)+1):

        if x%i == 0:

            ass.add(i)

            ass.add(x//i)

    return ass

a0 = A[0]

a1 = A[1]

div(a0)

div(a1)

ans = []

for i in ass:

    cnt = 0

    for a in A:

        if a%i == 0:

            cnt += 1

    if cnt >= n-1:

        ans.append(i)

print((max(ans)))
from fractions import gcd

N = int(eval(input()))

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

Gleft = [A[0]]

Gright = [A[-1]]

for i in range(1,N):

    Gleft.append(gcd(Gleft[-1],A[i]))

    Gright.append(gcd(Gright[-1],A[-1-i]))

Gright = Gright[::-1]

res = max(Gright[1],Gleft[-2])

for i in range(1,N-1):

    res = max(res,gcd(Gleft[i-1],Gright[i+1]))

print(res)
import sys

sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")
MOD = 10**9 + 7
n = int(eval(input()))
A = list(map(int, input().split()))
ass = set()


def div(x):
    for i in range(1, int(x**0.5) + 1):
        if x % i == 0:
            ass.add(i)
            ass.add(x // i)
    return ass


a0 = A[0]
a1 = A[1]
div(a0)
div(a1)
ans = []
for i in ass:
    cnt = 0
    for a in A:
        if a % i == 0:
            cnt += 1
    if cnt >= n - 1:
        ans.append(i)
print((max(ans)))

from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
Gleft = [A[0]]
Gright = [A[-1]]
for i in range(1, N):
    Gleft.append(gcd(Gleft[-1], A[i]))
    Gright.append(gcd(Gright[-1], A[-1 - i]))
Gright = Gright[::-1]
res = max(Gright[1], Gleft[-2])
for i in range(1, N - 1):
    res = max(res, gcd(Gleft[i - 1], Gright[i + 1]))
print(res)

-import sys +from fractions import gcd -sys.setrecursionlimit(10**7) -input = sys.stdin.readline -INF = float("inf") -MOD = 10**9 + 7 -n = int(eval(input())) +N = int(eval(input())) -ass = set() - - -def div(x): -    for i in range(1, int(x**0.5) + 1): -        if x % i == 0: -            ass.add(i) -            ass.add(x // i) -    return ass - - -a0 = A[0] -a1 = A[1] -div(a0) -div(a1) -ans = [] -for i in ass: -    cnt = 0 -    for a in A: -        if a % i == 0: -            cnt += 1 -    if cnt >= n - 1: -        ans.append(i) -print((max(ans))) +Gleft = [A[0]] +Gright = [A[-1]] +for i in range(1, N): +    Gleft.append(gcd(Gleft[-1], A[i])) +    Gright.append(gcd(Gright[-1], A[-1 - i])) +Gright = Gright[::-1] +res = max(Gright[1], Gleft[-2]) +for i in range(1, N - 1): +    res = max(res, gcd(Gleft[i - 1], Gright[i + 1])) +print(res)