from collections import Counter



def getDivisor(x):

    ans = []

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

        if x % d == 0:

            ans.append(d)

            if x//d != d:

                ans.append(x//d)

    return sorted(ans)



N = int(eval(input()))

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



divisors = getDivisor(As[0]) + getDivisor(As[1])

cnt = Counter(divisors)



for i, A in enumerate(As[2:], 2):

    for d, num in list(cnt.items()):

        if A%d == 0:

            cnt[d] += 1



    for d, num in list(cnt.items()):

        if num < i:

            del cnt[d]



print((max(cnt.keys())))

from itertools import accumulate



def gcd(a, b):

    while b:

        a, b = b, a%b

    return a



N = int(eval(input()))

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



Ls = [As[-1]] + list(accumulate(As, gcd))

Rs = list(accumulate(As[::-1], gcd))[::-1] + [As[0]]



ans = 0

for i in range(N):

    g = gcd(Ls[i], Rs[i+1])

    ans = max(ans, g)

print(ans)

from collections import Counter


def getDivisor(x):
    ans = []
    for d in range(1, int(x**0.5) + 1):
        if x % d == 0:
            ans.append(d)
            if x // d != d:
                ans.append(x // d)
    return sorted(ans)


N = int(eval(input()))
As = list(map(int, input().split()))
divisors = getDivisor(As[0]) + getDivisor(As[1])
cnt = Counter(divisors)
for i, A in enumerate(As[2:], 2):
    for d, num in list(cnt.items()):
        if A % d == 0:
            cnt[d] += 1
    for d, num in list(cnt.items()):
        if num < i:
            del cnt[d]
print((max(cnt.keys())))

from itertools import accumulate


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


N = int(eval(input()))
As = list(map(int, input().split()))
Ls = [As[-1]] + list(accumulate(As, gcd))
Rs = list(accumulate(As[::-1], gcd))[::-1] + [As[0]]
ans = 0
for i in range(N):
    g = gcd(Ls[i], Rs[i + 1])
    ans = max(ans, g)
print(ans)

-from collections import Counter +from itertools import accumulate -def getDivisor(x): -    ans = [] -    for d in range(1, int(x**0.5) + 1): -        if x % d == 0: -            ans.append(d) -            if x // d != d: -                ans.append(x // d) -    return sorted(ans) +def gcd(a, b): +    while b: +        a, b = b, a % b +    return a -divisors = getDivisor(As[0]) + getDivisor(As[1]) -cnt = Counter(divisors) -for i, A in enumerate(As[2:], 2): -    for d, num in list(cnt.items()): -        if A % d == 0: -            cnt[d] += 1 -    for d, num in list(cnt.items()): -        if num < i: -            del cnt[d] -print((max(cnt.keys()))) +Ls = [As[-1]] + list(accumulate(As, gcd)) +Rs = list(accumulate(As[::-1], gcd))[::-1] + [As[0]] +ans = 0 +for i in range(N): +    g = gcd(Ls[i], Rs[i + 1]) +    ans = max(ans, g) +print(ans)