from fractions import gcd

n = int(eval(input()))

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

lg = [a[0]]

rg = [a[-1]]

for i in range(n-1):

    lg.append(gcd(lg[-1],a[i+1]))

    rg.append(gcd(rg[-1],a[-i-2]))

rg.reverse()

ans = 0

for i in range(n):

    if i == 0:

        ans = rg[i+1]

    elif i == n-1:

        ans = max(ans,lg[i-1])

    else:

        ans = max(ans,gcd(lg[i-1],rg[i+1]))



print(ans)
from fractions import gcd

def main():

    n = int(eval(input()))

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

    lg = [a[0]]

    rg = [a[-1]]

    for i in range(n-1):

        lg.append(gcd(lg[-1],a[i+1]))

        rg.append(gcd(rg[-1],a[-i-2]))

    rg.reverse()

    ans = 0

    for i in range(n):

        if i == 0:

            ans = rg[i+1]

        elif i == n-1:

            ans = max(ans,lg[i-1])

        else:

            ans = max(ans,gcd(lg[i-1],rg[i+1]))



    print(ans)



if __name__ == "__main__":

    main()
from fractions import gcd

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

from fractions import gcd


def main():
    n = int(eval(input()))
    a = list(map(int, input().split()))
    lg = [a[0]]
    rg = [a[-1]]
    for i in range(n - 1):
        lg.append(gcd(lg[-1], a[i + 1]))
        rg.append(gcd(rg[-1], a[-i - 2]))
    rg.reverse()
    ans = 0
    for i in range(n):
        if i == 0:
            ans = rg[i + 1]
        elif i == n - 1:
            ans = max(ans, lg[i - 1])
        else:
            ans = max(ans, gcd(lg[i - 1], rg[i + 1]))
    print(ans)


if __name__ == "__main__":
    main()

-n = int(eval(input())) -a = list(map(int, input().split())) -lg = [a[0]] -rg = [a[-1]] -for i in range(n - 1): -    lg.append(gcd(lg[-1], a[i + 1])) -    rg.append(gcd(rg[-1], a[-i - 2])) -rg.reverse() -ans = 0 -for i in range(n): -    if i == 0: -        ans = rg[i + 1] -    elif i == n - 1: -        ans = max(ans, lg[i - 1]) -    else: -        ans = max(ans, gcd(lg[i - 1], rg[i + 1])) -print(ans) + +def main(): +    n = int(eval(input())) +    a = list(map(int, input().split())) +    lg = [a[0]] +    rg = [a[-1]] +    for i in range(n - 1): +        lg.append(gcd(lg[-1], a[i + 1])) +        rg.append(gcd(rg[-1], a[-i - 2])) +    rg.reverse() +    ans = 0 +    for i in range(n): +        if i == 0: +            ans = rg[i + 1] +        elif i == n - 1: +            ans = max(ans, lg[i - 1]) +        else: +            ans = max(ans, gcd(lg[i - 1], rg[i + 1])) +    print(ans) + + +if __name__ == "__main__": +    main()