n=int(eval(input()))

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

a.sort()

d={}



def make_divisors(n):

    divisors = []

    for i in range(1, int(n**0.5)+1):

        if n % i == 0:

            divisors.append(i)

            if i != n // i:

                divisors.append(n//i)

    return divisors

for i in make_divisors(a[0]):

    d[i]=1





for g in range(1,n):

    if g==1:

        new={}

        for i,m in list(d.items()):

            if a[g]%i==0:

                d[i]+=1

                if not a[g]//i in list(d.keys()):

                    new[a[g]//i]=1

        d.update(new)

    else:

        for i,m in list(d.items()):

            if a[g]%i==0:

                d[i]+=1



ans=1

for i,m in list(d.items()):

    if m==n-1 or m==n:

        ans=max(ans,i)

print(ans)
from collections import defaultdict

n=int(eval(input()))

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

a.sort()

d=defaultdict(int)



def make_divisors(n):

    divisors = []

    for i in range(1, int(n**0.5)+1):

        if n % i == 0:

            divisors.append(i)

            if i != n // i:

                divisors.append(n//i)

    return divisors



for i in make_divisors(a[0]):

    d[i]+=1

for g in make_divisors(a[1]):

    d[g]+=1



for g in range(2,n):

    for i,m in list(d.items()):

        if a[g]%i==0:

            d[i]+=1



ans=1

for i,m in list(d.items()):

    if m==n-1 or m==n:

        ans=max(ans,i)

print(ans)
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
d = {}


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors


for i in make_divisors(a[0]):
    d[i] = 1
for g in range(1, n):
    if g == 1:
        new = {}
        for i, m in list(d.items()):
            if a[g] % i == 0:
                d[i] += 1
                if not a[g] // i in list(d.keys()):
                    new[a[g] // i] = 1
        d.update(new)
    else:
        for i, m in list(d.items()):
            if a[g] % i == 0:
                d[i] += 1
ans = 1
for i, m in list(d.items()):
    if m == n - 1 or m == n:
        ans = max(ans, i)
print(ans)

from collections import defaultdict

n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
d = defaultdict(int)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors


for i in make_divisors(a[0]):
    d[i] += 1
for g in make_divisors(a[1]):
    d[g] += 1
for g in range(2, n):
    for i, m in list(d.items()):
        if a[g] % i == 0:
            d[i] += 1
ans = 1
for i, m in list(d.items()):
    if m == n - 1 or m == n:
        ans = max(ans, i)
print(ans)

+from collections import defaultdict + -d = {} +d = defaultdict(int) -    d[i] = 1 -for g in range(1, n): -    if g == 1: -        new = {} -        for i, m in list(d.items()): -            if a[g] % i == 0: -                d[i] += 1 -                if not a[g] // i in list(d.keys()): -                    new[a[g] // i] = 1 -        d.update(new) -    else: -        for i, m in list(d.items()): -            if a[g] % i == 0: -                d[i] += 1 +    d[i] += 1 +for g in make_divisors(a[1]): +    d[g] += 1 +for g in range(2, n): +    for i, m in list(d.items()): +        if a[g] % i == 0: +            d[i] += 1