n = int(eval(input()))

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

ans1 = a[1]

for i in range(1,n):

  big,sml = a[i],ans1

  while sml != 0:

    big,sml = sml,big%sml

  ans1 = big

ans2 = a[-2]

for i in range(n-1):

  big,sml = a[i],ans2

  while sml != 0:

    big,sml = sml,big%sml

  ans2 = big

l1 = [-1]

now = a[0]

for i in range(1,n):

  big,sml = now,a[i]

  while sml != 0:

    big,sml = sml,big%sml

  l1.append(now // big)

  now = big

l2 = [-1]

now = a[-1]

for i in range(n-2,-1,-1):

  big,sml = now,a[i]

  while sml != 0:

    big,sml = sml,big%sml

  l2.append(now // big)

  now = big

l2.reverse()

l3 = [-1]

for i in range(1,n-1):

  big,sml = l1[i],l2[i]

  while sml != 0:

    big,sml = sml,big%sml

  l3.append(big)

l3.append(-1)

now = a[0]

for i in range(n):

  big,sml = now,a[i]

  while sml != 0:

    big,sml = sml,big%sml

  now = big

ans3 = now * max(l3)

#print(now)

#print(l1)

#print(l2)

#print(l3)

#print(ans1,ans2,ans3)

print((max(ans1,ans2,ans3)))
#14:10

n = int(eval(input()))

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

b = []

for i in range(n):

  if i == 0:

    b.append(a[i])

  else:

    big = b[-1]

    sml = a[i]

    while sml != 0:

      big,sml = sml,big%sml

    b.append(big)

c = []

for j in range(n)[::-1]:

  if j == n-1:

    c.append(a[j])

  else:

    big = c[-1]

    sml = a[j]

    while sml != 0:

      big,sml = sml,big%sml

    c.append(big)

c.reverse()

d = []

for i in range(n):

  if i == 0:

    d.append(c[1])

  elif i == n-1:

    d.append(b[n-2])

  else:

    big = b[i-1]

    sml = c[i+1]

    while sml != 0:

      big,sml = sml,big%sml

    d.append(big)

#print(b)

#print(c)

#print(d)

print((max(d)))
n = int(eval(input()))
a = list(map(int, input().split()))
ans1 = a[1]
for i in range(1, n):
    big, sml = a[i], ans1
    while sml != 0:
        big, sml = sml, big % sml
    ans1 = big
ans2 = a[-2]
for i in range(n - 1):
    big, sml = a[i], ans2
    while sml != 0:
        big, sml = sml, big % sml
    ans2 = big
l1 = [-1]
now = a[0]
for i in range(1, n):
    big, sml = now, a[i]
    while sml != 0:
        big, sml = sml, big % sml
    l1.append(now // big)
    now = big
l2 = [-1]
now = a[-1]
for i in range(n - 2, -1, -1):
    big, sml = now, a[i]
    while sml != 0:
        big, sml = sml, big % sml
    l2.append(now // big)
    now = big
l2.reverse()
l3 = [-1]
for i in range(1, n - 1):
    big, sml = l1[i], l2[i]
    while sml != 0:
        big, sml = sml, big % sml
    l3.append(big)
l3.append(-1)
now = a[0]
for i in range(n):
    big, sml = now, a[i]
    while sml != 0:
        big, sml = sml, big % sml
    now = big
ans3 = now * max(l3)
# print(now)
# print(l1)
# print(l2)
# print(l3)
# print(ans1,ans2,ans3)
print((max(ans1, ans2, ans3)))

# 14:10
n = int(eval(input()))
a = list(map(int, input().split()))
b = []
for i in range(n):
    if i == 0:
        b.append(a[i])
    else:
        big = b[-1]
        sml = a[i]
        while sml != 0:
            big, sml = sml, big % sml
        b.append(big)
c = []
for j in range(n)[::-1]:
    if j == n - 1:
        c.append(a[j])
    else:
        big = c[-1]
        sml = a[j]
        while sml != 0:
            big, sml = sml, big % sml
        c.append(big)
c.reverse()
d = []
for i in range(n):
    if i == 0:
        d.append(c[1])
    elif i == n - 1:
        d.append(b[n - 2])
    else:
        big = b[i - 1]
        sml = c[i + 1]
        while sml != 0:
            big, sml = sml, big % sml
        d.append(big)
# print(b)
# print(c)
# print(d)
print((max(d)))

+# 14:10 -ans1 = a[1] -for i in range(1, n): -    big, sml = a[i], ans1 -    while sml != 0: -        big, sml = sml, big % sml -    ans1 = big -ans2 = a[-2] -for i in range(n - 1): -    big, sml = a[i], ans2 -    while sml != 0: -        big, sml = sml, big % sml -    ans2 = big -l1 = [-1] -now = a[0] -for i in range(1, n): -    big, sml = now, a[i] -    while sml != 0: -        big, sml = sml, big % sml -    l1.append(now // big) -    now = big -l2 = [-1] -now = a[-1] -for i in range(n - 2, -1, -1): -    big, sml = now, a[i] -    while sml != 0: -        big, sml = sml, big % sml -    l2.append(now // big) -    now = big -l2.reverse() -l3 = [-1] -for i in range(1, n - 1): -    big, sml = l1[i], l2[i] -    while sml != 0: -        big, sml = sml, big % sml -    l3.append(big) -l3.append(-1) -now = a[0] +b = [] -    big, sml = now, a[i] -    while sml != 0: -        big, sml = sml, big % sml -    now = big -ans3 = now * max(l3) -# print(now) -# print(l1) -# print(l2) -# print(l3) -# print(ans1,ans2,ans3) -print((max(ans1, ans2, ans3))) +    if i == 0: +        b.append(a[i]) +    else: +        big = b[-1] +        sml = a[i] +        while sml != 0: +            big, sml = sml, big % sml +        b.append(big) +c = [] +for j in range(n)[::-1]: +    if j == n - 1: +        c.append(a[j]) +    else: +        big = c[-1] +        sml = a[j] +        while sml != 0: +            big, sml = sml, big % sml +        c.append(big) +c.reverse() +d = [] +for i in range(n): +    if i == 0: +        d.append(c[1]) +    elif i == n - 1: +        d.append(b[n - 2]) +    else: +        big = b[i - 1] +        sml = c[i + 1] +        while sml != 0: +            big, sml = sml, big % sml +        d.append(big) +# print(b) +# print(c) +# print(d) +print((max(d)))