import sys

from functools import lru_cache



@lru_cache(maxsize=None)

def gcd(a, b):

    if b == 0:

        return a

    if a % b == 0:

        return b

    else:

        return gcd(b, a % b)





N, *A = list(map(int, sys.stdin.read().split()))

L = [0] * (N + 2)

R = [0] * (N + 2)

for i in range(N):

    L[i + 2] = gcd(L[i + 1], A[i])

    R[-i - 2] = gcd(R[-i - 1], A[-i - 1])



print((max(gcd(L[i], R[i + 1]) for i in range(1, N + 1))))

import sys

from functools import lru_cache

sys.setrecursionlimit(1000000)



@lru_cache(maxsize=None)

def main():



    def gcd(a, b):

        if b == 0:

            return a

        if a % b == 0:

            return b

        else:

            return gcd(b, a % b)



    N, *A = list(map(int, sys.stdin.read().split()))

    L = [0] * (N + 2)

    R = [0] * (N + 2)

    for i in range(N):

        L[i + 2] = gcd(L[i + 1], A[i])

        R[-i - 2] = gcd(R[-i - 1], A[-i - 1])



    print((max(gcd(L[i], R[i + 1]) for i in range(1, N + 1))))



if __name__=='__main__':

  main()
import sys
from functools import lru_cache


@lru_cache(maxsize=None)
def gcd(a, b):
    if b == 0:
        return a
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)


N, *A = list(map(int, sys.stdin.read().split()))
L = [0] * (N + 2)
R = [0] * (N + 2)
for i in range(N):
    L[i + 2] = gcd(L[i + 1], A[i])
    R[-i - 2] = gcd(R[-i - 1], A[-i - 1])
print((max(gcd(L[i], R[i + 1]) for i in range(1, N + 1))))

import sys
from functools import lru_cache

sys.setrecursionlimit(1000000)


@lru_cache(maxsize=None)
def main():
    def gcd(a, b):
        if b == 0:
            return a
        if a % b == 0:
            return b
        else:
            return gcd(b, a % b)

    N, *A = list(map(int, sys.stdin.read().split()))
    L = [0] * (N + 2)
    R = [0] * (N + 2)
    for i in range(N):
        L[i + 2] = gcd(L[i + 1], A[i])
        R[-i - 2] = gcd(R[-i - 1], A[-i - 1])
    print((max(gcd(L[i], R[i + 1]) for i in range(1, N + 1))))


if __name__ == "__main__":
    main()

+sys.setrecursionlimit(1000000) + -def gcd(a, b): -    if b == 0: -        return a -    if a % b == 0: -        return b -    else: -        return gcd(b, a % b) +def main(): +    def gcd(a, b): +        if b == 0: +            return a +        if a % b == 0: +            return b +        else: +            return gcd(b, a % b) + +    N, *A = list(map(int, sys.stdin.read().split())) +    L = [0] * (N + 2) +    R = [0] * (N + 2) +    for i in range(N): +        L[i + 2] = gcd(L[i + 1], A[i]) +        R[-i - 2] = gcd(R[-i - 1], A[-i - 1]) +    print((max(gcd(L[i], R[i + 1]) for i in range(1, N + 1)))) -N, *A = list(map(int, sys.stdin.read().split())) -L = [0] * (N + 2) -R = [0] * (N + 2) -for i in range(N): -    L[i + 2] = gcd(L[i + 1], A[i]) -    R[-i - 2] = gcd(R[-i - 1], A[-i - 1]) -print((max(gcd(L[i], R[i + 1]) for i in range(1, N + 1)))) +if __name__ == "__main__": +    main()