n = int(eval(input()))

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



def make_divisors(n):

    divisors = []

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

        if n % i == 0:

            divisors.append(i)

            if i != n // i:

                divisors.append(n//i)

    return divisors



# 1個目と2個目の約数列挙

# ⇨ 1個しか消さないから必ずどちらかの約数は残る

divs = make_divisors(As[0]) + make_divisors(As[1])

divs = list(set(divs))

cnt = 1



for div in sorted(divs,reverse=True):

    a = sum([1 for a in As if a%div == 0])

    if n - a <= 1:

        print(div)

        exit()
n = int(eval(input()))

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

# from math import gcd

def gcd(n, m):

    # 最大公約数

    a = max(n,m)

    b = min(n,m)

    while b:

        a, b = b, a % b

    return a

# 左からの累積GCDと

g = As[0]

left = []

for a in As:

    g = gcd(g, a)

    left.append(g)

# 右からの累積GCD

As_r = As[::-1]

g_r = As_r[0]

right = []    

for a in As_r:

    g_r = gcd(g_r, a)

    right.append(g_r)

    

l = left

r = right[::-1]

ans = 0

for i in range(n):

    if i == 0:

        ans = max(ans, r[1])

    elif i == n-1:

        ans = max(ans, l[n-2])

    else:     

        g = gcd(l[i-1],r[i+1])

        ans = max(ans, g)

print(ans)
n = int(eval(input()))
As = list(map(int, input().split()))


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors


# 1個目と2個目の約数列挙
# ⇨ 1個しか消さないから必ずどちらかの約数は残る
divs = make_divisors(As[0]) + make_divisors(As[1])
divs = list(set(divs))
cnt = 1
for div in sorted(divs, reverse=True):
    a = sum([1 for a in As if a % div == 0])
    if n - a <= 1:
        print(div)
        exit()

n = int(eval(input()))
As = list(map(int, input().split()))
# from math import gcd
def gcd(n, m):
    # 最大公約数
    a = max(n, m)
    b = min(n, m)
    while b:
        a, b = b, a % b
    return a


# 左からの累積GCDと
g = As[0]
left = []
for a in As:
    g = gcd(g, a)
    left.append(g)
# 右からの累積GCD
As_r = As[::-1]
g_r = As_r[0]
right = []
for a in As_r:
    g_r = gcd(g_r, a)
    right.append(g_r)
l = left
r = right[::-1]
ans = 0
for i in range(n):
    if i == 0:
        ans = max(ans, r[1])
    elif i == n - 1:
        ans = max(ans, l[n - 2])
    else:
        g = gcd(l[i - 1], r[i + 1])
        ans = max(ans, g)
print(ans)

+# from math import gcd +def gcd(n, m): +    # 最大公約数 +    a = max(n, m) +    b = min(n, m) +    while b: +        a, b = b, a % b +    return a -def make_divisors(n): -    divisors = [] -    for i in range(1, int(n**0.5) + 1): -        if n % i == 0: -            divisors.append(i) -            if i != n // i: -                divisors.append(n // i) -    return divisors - - -# 1個目と2個目の約数列挙 -# ⇨ 1個しか消さないから必ずどちらかの約数は残る -divs = make_divisors(As[0]) + make_divisors(As[1]) -divs = list(set(divs)) -cnt = 1 -for div in sorted(divs, reverse=True): -    a = sum([1 for a in As if a % div == 0]) -    if n - a <= 1: -        print(div) -        exit() +# 左からの累積GCDと +g = As[0] +left = [] +for a in As: +    g = gcd(g, a) +    left.append(g) +# 右からの累積GCD +As_r = As[::-1] +g_r = As_r[0] +right = [] +for a in As_r: +    g_r = gcd(g_r, a) +    right.append(g_r) +l = left +r = right[::-1] +ans = 0 +for i in range(n): +    if i == 0: +        ans = max(ans, r[1]) +    elif i == n - 1: +        ans = max(ans, l[n - 2]) +    else: +        g = gcd(l[i - 1], r[i + 1]) +        ans = max(ans, g) +print(ans)