# ABC125C - GCD on Blackboard

# Accumulative GCD

from fractions import gcd



n = int(eval(input()))

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



left = [0] * (n + 1)

right = [0] * (n + 1)

for i in range(n):

    left[i + 1] = gcd(left[i], a[i])

    right[n - i - 1] = gcd(right[n - i], a[n - i - 1])



ans = 0

for i in range(n):

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

print(ans)
# ABC125C - GCD on Blackboard

# Accumulative GCD

from fractions import gcd



def main():

    n = int(eval(input()))

    a = tuple(map(int, input().rstrip().split()))



    left = [0] * (n + 1)

    right = [0] * (n + 1)

    for i in range(n):

        left[i + 1] = gcd(left[i], a[i])

        right[n - i - 1] = gcd(right[n - i], a[n - i - 1])



    ans = 0

    for i in range(n):

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

    print(ans)





if __name__ == "__main__":

    main()
# ABC125C - GCD on Blackboard
# Accumulative GCD
from fractions import gcd

n = int(eval(input()))
a = list(map(int, input().rstrip().split()))
left = [0] * (n + 1)
right = [0] * (n + 1)
for i in range(n):
    left[i + 1] = gcd(left[i], a[i])
    right[n - i - 1] = gcd(right[n - i], a[n - i - 1])
ans = 0
for i in range(n):
    ans = max(ans, gcd(left[i], right[i + 1]))
print(ans)

# ABC125C - GCD on Blackboard
# Accumulative GCD
from fractions import gcd


def main():
    n = int(eval(input()))
    a = tuple(map(int, input().rstrip().split()))
    left = [0] * (n + 1)
    right = [0] * (n + 1)
    for i in range(n):
        left[i + 1] = gcd(left[i], a[i])
        right[n - i - 1] = gcd(right[n - i], a[n - i - 1])
    ans = 0
    for i in range(n):
        ans = max(ans, gcd(left[i], right[i + 1]))
    print(ans)


if __name__ == "__main__":
    main()

-n = int(eval(input())) -a = list(map(int, input().rstrip().split())) -left = [0] * (n + 1) -right = [0] * (n + 1) -for i in range(n): -    left[i + 1] = gcd(left[i], a[i]) -    right[n - i - 1] = gcd(right[n - i], a[n - i - 1]) -ans = 0 -for i in range(n): -    ans = max(ans, gcd(left[i], right[i + 1])) -print(ans) + +def main(): +    n = int(eval(input())) +    a = tuple(map(int, input().rstrip().split())) +    left = [0] * (n + 1) +    right = [0] * (n + 1) +    for i in range(n): +        left[i + 1] = gcd(left[i], a[i]) +        right[n - i - 1] = gcd(right[n - i], a[n - i - 1]) +    ans = 0 +    for i in range(n): +        ans = max(ans, gcd(left[i], right[i + 1])) +    print(ans) + + +if __name__ == "__main__": +    main()