from fractions import gcd

def main():

    n = int(eval(input()))

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

    ar = a[::-1]

    lgcds = [1]*n

    rgcds = [1]*n

    lgcd, rgcd = a[0], ar[0]

    lgcds[0] = rgcd

    lgcds[1] = lgcd

    rgcds[n-1] = lgcd

    rgcds[n-2] = rgcd

    for i in range(2, n):

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

        rgcd = gcd(rgcd, ar[i-1])

        lgcds[i] = lgcd

        rgcds[n-1-i] = rgcd

    ans = 1

    for i in range(n):

        gi = gcd(lgcds[i], rgcds[i])

        if gi > ans:

            ans = gi

    print(ans)

    



if __name__ == "__main__":

    main()
def main():

    n = int(eval(input()))

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

    ar = a[::-1]

    lgcds = [1]*n

    rgcds = [1]*n

    lgcd, rgcd = a[0], ar[0]

    lgcds[0] = rgcd

    lgcds[1] = lgcd

    rgcds[n-1] = lgcd

    rgcds[n-2] = rgcd

    for i in range(2, n):

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

        rgcd = gcd(rgcd, ar[i-1])

        lgcds[i] = lgcd

        rgcds[n-1-i] = rgcd

    ans = 1

    for i in range(n):

        gi = gcd(lgcds[i], rgcds[i])

        if gi > ans:

            ans = gi

    print(ans)



def gcd(x, y):

    r = x % y

    while r:

        x, y, r = y, r, y%r

    return y



if __name__ == "__main__":

    main()
from fractions import gcd


def main():
    n = int(eval(input()))
    a = list(map(int, input().split()))
    ar = a[::-1]
    lgcds = [1] * n
    rgcds = [1] * n
    lgcd, rgcd = a[0], ar[0]
    lgcds[0] = rgcd
    lgcds[1] = lgcd
    rgcds[n - 1] = lgcd
    rgcds[n - 2] = rgcd
    for i in range(2, n):
        lgcd = gcd(lgcd, a[i - 1])
        rgcd = gcd(rgcd, ar[i - 1])
        lgcds[i] = lgcd
        rgcds[n - 1 - i] = rgcd
    ans = 1
    for i in range(n):
        gi = gcd(lgcds[i], rgcds[i])
        if gi > ans:
            ans = gi
    print(ans)


if __name__ == "__main__":
    main()

def main():
    n = int(eval(input()))
    a = list(map(int, input().split()))
    ar = a[::-1]
    lgcds = [1] * n
    rgcds = [1] * n
    lgcd, rgcd = a[0], ar[0]
    lgcds[0] = rgcd
    lgcds[1] = lgcd
    rgcds[n - 1] = lgcd
    rgcds[n - 2] = rgcd
    for i in range(2, n):
        lgcd = gcd(lgcd, a[i - 1])
        rgcd = gcd(rgcd, ar[i - 1])
        lgcds[i] = lgcd
        rgcds[n - 1 - i] = rgcd
    ans = 1
    for i in range(n):
        gi = gcd(lgcds[i], rgcds[i])
        if gi > ans:
            ans = gi
    print(ans)


def gcd(x, y):
    r = x % y
    while r:
        x, y, r = y, r, y % r
    return y


if __name__ == "__main__":
    main()

-from fractions import gcd - - +def gcd(x, y): +    r = x % y +    while r: +        x, y, r = y, r, y % r +    return y + +