import fractions





def main() -> None:

    N = int(eval(input()))

    A = [int(x) for x in input().split()]



    left = [0] * (N + 1)

    right = [0] * (N + 1)

    for i in range(N):

        left[i + 1] = (fractions.gcd(left[i], A[i]))

        right[N - i - 1] = (fractions.gcd(right[N - i], A[N - 1 - i]))



    ans = 0

    for i in range(N):

        ans = max(ans, fractions.gcd(left[i], right[i + 1]))

    print(ans)





if __name__ == '__main__':

    main()

import fractions





def main() -> None:

    N = int(eval(input()))

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



    gcd_l = [0]

    gcd_r = [0]

    for i in range(N):

        gcd_l.append(fractions.gcd(gcd_l[i], A[i]))

        gcd_r.append(fractions.gcd(gcd_r[i], A[-(i + 1)]))

    gcd_r = gcd_r[::-1]



    ans = []

    for i in range(N):

        ans.append(fractions.gcd(gcd_l[i], gcd_r[i + 1]))



    print((max(ans)))





if __name__ == '__main__':

    main()

import fractions


def main() -> None:
    N = int(eval(input()))
    A = [int(x) for x in input().split()]
    left = [0] * (N + 1)
    right = [0] * (N + 1)
    for i in range(N):
        left[i + 1] = fractions.gcd(left[i], A[i])
        right[N - i - 1] = fractions.gcd(right[N - i], A[N - 1 - i])
    ans = 0
    for i in range(N):
        ans = max(ans, fractions.gcd(left[i], right[i + 1]))
    print(ans)


if __name__ == "__main__":
    main()

import fractions


def main() -> None:
    N = int(eval(input()))
    A = list(map(int, input().split()))
    gcd_l = [0]
    gcd_r = [0]
    for i in range(N):
        gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
        gcd_r.append(fractions.gcd(gcd_r[i], A[-(i + 1)]))
    gcd_r = gcd_r[::-1]
    ans = []
    for i in range(N):
        ans.append(fractions.gcd(gcd_l[i], gcd_r[i + 1]))
    print((max(ans)))


if __name__ == "__main__":
    main()

-    A = [int(x) for x in input().split()] -    left = [0] * (N + 1) -    right = [0] * (N + 1) +    A = list(map(int, input().split())) +    gcd_l = [0] +    gcd_r = [0] -        left[i + 1] = fractions.gcd(left[i], A[i]) -        right[N - i - 1] = fractions.gcd(right[N - i], A[N - 1 - i]) -    ans = 0 +        gcd_l.append(fractions.gcd(gcd_l[i], A[i])) +        gcd_r.append(fractions.gcd(gcd_r[i], A[-(i + 1)])) +    gcd_r = gcd_r[::-1] +    ans = [] -        ans = max(ans, fractions.gcd(left[i], right[i + 1])) -    print(ans) +        ans.append(fractions.gcd(gcd_l[i], gcd_r[i + 1])) +    print((max(ans)))