def slove():

    import sys

    import fractions

    input = sys.stdin.readline

    n = int(input().rstrip('\n'))

    a = list(map(int, input().rstrip('\n').split()))

    f = [0] * (n + 1)

    b = [0] * (n + 1)

    for i in range(n):

        f[i+1] = fractions.gcd(f[i], a[i])

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

    m_gcd = 0

    for i in range(n):

        m_gcd = max(m_gcd, fractions.gcd(f[i], b[i+1]))

    print(m_gcd)





if __name__ == '__main__':

    slove()

def slove():

    import sys

    import fractions

    input = sys.stdin.readline

    n = int(input().rstrip('\n'))

    a = list(map(int, input().rstrip('\n').split()))

    l = [0] * (n + 1)

    r = [0] * (n + 1)

    for i in range(n):

        l[i+1] = fractions.gcd(l[i], a[i])

        r[-i-2] = fractions.gcd(r[-i-1], a[-i-1])

    md = 0

    for i in range(n):

        md = max(md, fractions.gcd(l[i], r[i+1]))

    print(md)





if __name__ == '__main__':

    slove()

def slove():
    import sys
    import fractions

    input = sys.stdin.readline
    n = int(input().rstrip("\n"))
    a = list(map(int, input().rstrip("\n").split()))
    f = [0] * (n + 1)
    b = [0] * (n + 1)
    for i in range(n):
        f[i + 1] = fractions.gcd(f[i], a[i])
        b[-i - 2] = fractions.gcd(b[-i - 1], a[-i - 1])
    m_gcd = 0
    for i in range(n):
        m_gcd = max(m_gcd, fractions.gcd(f[i], b[i + 1]))
    print(m_gcd)


if __name__ == "__main__":
    slove()

def slove():
    import sys
    import fractions

    input = sys.stdin.readline
    n = int(input().rstrip("\n"))
    a = list(map(int, input().rstrip("\n").split()))
    l = [0] * (n + 1)
    r = [0] * (n + 1)
    for i in range(n):
        l[i + 1] = fractions.gcd(l[i], a[i])
        r[-i - 2] = fractions.gcd(r[-i - 1], a[-i - 1])
    md = 0
    for i in range(n):
        md = max(md, fractions.gcd(l[i], r[i + 1]))
    print(md)


if __name__ == "__main__":
    slove()

-    f = [0] * (n + 1) -    b = [0] * (n + 1) +    l = [0] * (n + 1) +    r = [0] * (n + 1) -        f[i + 1] = fractions.gcd(f[i], a[i]) -        b[-i - 2] = fractions.gcd(b[-i - 1], a[-i - 1]) -    m_gcd = 0 +        l[i + 1] = fractions.gcd(l[i], a[i]) +        r[-i - 2] = fractions.gcd(r[-i - 1], a[-i - 1]) +    md = 0 -        m_gcd = max(m_gcd, fractions.gcd(f[i], b[i + 1])) -    print(m_gcd) +        md = max(md, fractions.gcd(l[i], r[i + 1])) +    print(md)