def GCD(a, b):

    """ Euclidean algorithm"""

    if a < b: (a, b) = (b, a)

    if b == 0: return a

    m = a % b

    while m != 0:

        a = b

        b = m

        m = a % b

    return b



N = int(input())

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



if N < 2 and 1e5 < N: raise()

for v in A:

    if v < 1 and v < 1e9: raise()





l_list = []

l = 0

for i in range(0, N):

    l = GCD(l, A[i])

    l_list.append( l )



r_list = []

r = 0

for i in range(-1, -(N+1), -1):

    r = GCD(r, A[i])

    r_list.append( r )



n = []    

for i in range(0, N):

    if i-1 < 0:

        l = 0

    else:

        l = l_list[i-1]

    if N-i-2 < 0:

        r = 0

    else:

        r = r_list[N-i-2]

    n.append(GCD(l, r))

print(max(n))

def GCD(a, b):

    """ Euclidean algorithm"""

    if a < b: (a, b) = (b, a)

    if b == 0: return a

    m = a % b

    while m != 0:

        a = b

        b = m

        m = a % b

    return b



N = int(input())

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

AR = list(reversed(A))



if N < 2 and 1e5 < N: raise()

for v in A:

    if v < 1 and v < 1e9: raise()



l_list = [0]

for i in range(0, N):

    l = GCD(l_list[i], A[i])

    l_list.append( l )



r_list = [0]

for i in range(0, N):

    r = GCD(r_list[i], AR[i])

    r_list.append( r )



n = []

j = -2   

for i in range(0, N):

    l = l_list[i]

    r = r_list[j]

    n.append(GCD(l, r))

    j -= 1

print(max(n))

def GCD(a, b):
    """Euclidean algorithm"""
    if a < b:
        (a, b) = (b, a)
    if b == 0:
        return a
    m = a % b
    while m != 0:
        a = b
        b = m
        m = a % b
    return b


N = int(input())
A = [int(v) for v in input().split()]
if N < 2 and 1e5 < N:
    raise ()
for v in A:
    if v < 1 and v < 1e9:
        raise ()
l_list = []
l = 0
for i in range(0, N):
    l = GCD(l, A[i])
    l_list.append(l)
r_list = []
r = 0
for i in range(-1, -(N + 1), -1):
    r = GCD(r, A[i])
    r_list.append(r)
n = []
for i in range(0, N):
    if i - 1 < 0:
        l = 0
    else:
        l = l_list[i - 1]
    if N - i - 2 < 0:
        r = 0
    else:
        r = r_list[N - i - 2]
    n.append(GCD(l, r))
print(max(n))

def GCD(a, b):
    """Euclidean algorithm"""
    if a < b:
        (a, b) = (b, a)
    if b == 0:
        return a
    m = a % b
    while m != 0:
        a = b
        b = m
        m = a % b
    return b


N = int(input())
A = [int(v) for v in input().split()]
AR = list(reversed(A))
if N < 2 and 1e5 < N:
    raise ()
for v in A:
    if v < 1 and v < 1e9:
        raise ()
l_list = [0]
for i in range(0, N):
    l = GCD(l_list[i], A[i])
    l_list.append(l)
r_list = [0]
for i in range(0, N):
    r = GCD(r_list[i], AR[i])
    r_list.append(r)
n = []
j = -2
for i in range(0, N):
    l = l_list[i]
    r = r_list[j]
    n.append(GCD(l, r))
    j -= 1
print(max(n))

+AR = list(reversed(A)) -l_list = [] -l = 0 +l_list = [0] -    l = GCD(l, A[i]) +    l = GCD(l_list[i], A[i]) -r_list = [] -r = 0 -for i in range(-1, -(N + 1), -1): -    r = GCD(r, A[i]) +r_list = [0] +for i in range(0, N): +    r = GCD(r_list[i], AR[i]) +j = -2 -    if i - 1 < 0: -        l = 0 -    else: -        l = l_list[i - 1] -    if N - i - 2 < 0: -        r = 0 -    else: -        r = r_list[N - i - 2] +    l = l_list[i] +    r = r_list[j] +    j -= 1