import sys

input = sys.stdin.readline

 

n = int(eval(input()))

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

a.sort()

#a,bの最大公約数

def gcd(a,b):

    if b == 0:

        return a

    else:

        return gcd(b,a%b)

#リスト l の最大公約数

def gcdlist(l):

    a = l[0]

    for i in range(len(l)):

        a = gcd(a,l[i])

    return a

#nの約数列挙

def divisor(n):

    ass = []

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

        if n%i == 0:

            ass.append(i)

            if i**2 == n:

                continue

            ass.append(n//i)

    return ass #sortされていない

 

#0番目を使わない場合

res = gcdlist(a[1::])

 

#else

p = sorted(divisor(a[0]))

for i in range(len(p)-1,-1,-1):

    if p[i]<=res:

        break

    cnt = 1

    for j in range(1,n):

        if a[j]%p[i]==0:

            cnt += 1

    if cnt >= n-1:

        res = p[i]

        break

print(res)
#a,bの最大公約数

def gcd(a,b):

    if b == 0:

        return a

    else:

        return gcd(b,a%b)



n = int(eval(input()))

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



#b[i]:a[0]~a[i]までのgcd,c[i]:a[i]~a[-1]までのgcd

b = [0]*n

c = [0]*n

for i in range(n):

    if i == 0:

        b[0] = a[0]

        c[-1] = a[-1]

        continue

    b[i]=gcd(b[i-1],a[i])

    c[n-1-i]=gcd(c[n-i],a[n-1-i])



res = max(b[n-2],c[1])

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

    res = max(res,gcd(b[i-1],c[i+1]))

print(res)

import sys

input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
# a,bの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


# リスト l の最大公約数
def gcdlist(l):
    a = l[0]
    for i in range(len(l)):
        a = gcd(a, l[i])
    return a


# nの約数列挙
def divisor(n):
    ass = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n // i)
    return ass  # sortされていない


# 0番目を使わない場合
res = gcdlist(a[1::])
# else
p = sorted(divisor(a[0]))
for i in range(len(p) - 1, -1, -1):
    if p[i] <= res:
        break
    cnt = 1
    for j in range(1, n):
        if a[j] % p[i] == 0:
            cnt += 1
    if cnt >= n - 1:
        res = p[i]
        break
print(res)

# a,bの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


n = int(eval(input()))
a = list(map(int, input().split()))
# b[i]:a[0]~a[i]までのgcd,c[i]:a[i]~a[-1]までのgcd
b = [0] * n
c = [0] * n
for i in range(n):
    if i == 0:
        b[0] = a[0]
        c[-1] = a[-1]
        continue
    b[i] = gcd(b[i - 1], a[i])
    c[n - 1 - i] = gcd(c[n - i], a[n - 1 - i])
res = max(b[n - 2], c[1])
for i in range(1, n - 1):
    res = max(res, gcd(b[i - 1], c[i + 1]))
print(res)

-import sys - -input = sys.stdin.readline -n = int(eval(input())) -a = list(map(int, input().split())) -a.sort() -# リスト l の最大公約数 -def gcdlist(l): -    a = l[0] -    for i in range(len(l)): -        a = gcd(a, l[i]) -    return a - - -# nの約数列挙 -def divisor(n): -    ass = [] -    for i in range(1, int(n**0.5) + 1): -        if n % i == 0: -            ass.append(i) -            if i**2 == n: -                continue -            ass.append(n // i) -    return ass  # sortされていない - - -# 0番目を使わない場合 -res = gcdlist(a[1::]) -# else -p = sorted(divisor(a[0])) -for i in range(len(p) - 1, -1, -1): -    if p[i] <= res: -        break -    cnt = 1 -    for j in range(1, n): -        if a[j] % p[i] == 0: -            cnt += 1 -    if cnt >= n - 1: -        res = p[i] -        break +n = int(eval(input())) +a = list(map(int, input().split())) +# b[i]:a[0]~a[i]までのgcd,c[i]:a[i]~a[-1]までのgcd +b = [0] * n +c = [0] * n +for i in range(n): +    if i == 0: +        b[0] = a[0] +        c[-1] = a[-1] +        continue +    b[i] = gcd(b[i - 1], a[i]) +    c[n - 1 - i] = gcd(c[n - i], a[n - 1 - i]) +res = max(b[n - 2], c[1]) +for i in range(1, n - 1): +    res = max(res, gcd(b[i - 1], c[i + 1]))