def main():

    from fractions import gcd



    n, *a = list(map(int, open(0).read().split()))

    a = [0] + a + [0]

    l = [0 for _ in range(n + 1)]

    r = [0 for _ in range(n + 1)]

    tmpl = 0

    tmpr = 0

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

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

        tmpr = gcd(tmpr, a[-i])

        l[i] = tmpl

        r[-i] = tmpr



    ans = 0

    for i, j in zip(l, r):

        g = gcd(i, j)

        ans = max(ans, g)



    print(ans)





if __name__ == '__main__':

    main()

def main():

    from fractions import gcd



    n, *a = list(map(int, open(0).read().split()))

    a = tuple([0] + a + [0])

    l = [0 for _ in range(n + 1)]

    r = [0 for _ in range(n + 1)]

    tmpl = 0

    tmpr = 0

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

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

        tmpr = gcd(tmpr, a[-i])

        l[i] = tmpl

        r[-i] = tmpr



    ans = 0

    for i, j in zip(l, r):

        g = gcd(i, j)

        ans = max(ans, g)



    print(ans)





if __name__ == '__main__':

    main()

def main():
    from fractions import gcd

    n, *a = list(map(int, open(0).read().split()))
    a = [0] + a + [0]
    l = [0 for _ in range(n + 1)]
    r = [0 for _ in range(n + 1)]
    tmpl = 0
    tmpr = 0
    for i in range(1, n + 1):
        tmpl = gcd(tmpl, a[i - 1])
        tmpr = gcd(tmpr, a[-i])
        l[i] = tmpl
        r[-i] = tmpr
    ans = 0
    for i, j in zip(l, r):
        g = gcd(i, j)
        ans = max(ans, g)
    print(ans)


if __name__ == "__main__":
    main()

def main():
    from fractions import gcd

    n, *a = list(map(int, open(0).read().split()))
    a = tuple([0] + a + [0])
    l = [0 for _ in range(n + 1)]
    r = [0 for _ in range(n + 1)]
    tmpl = 0
    tmpr = 0
    for i in range(1, n + 1):
        tmpl = gcd(tmpl, a[i - 1])
        tmpr = gcd(tmpr, a[-i])
        l[i] = tmpl
        r[-i] = tmpr
    ans = 0
    for i, j in zip(l, r):
        g = gcd(i, j)
        ans = max(ans, g)
    print(ans)


if __name__ == "__main__":
    main()

-    a = [0] + a + [0] +    a = tuple([0] + a + [0])