# セグメント木。区間における要素の取得をO(logN)で行うことが可能である。

class SegTree():

    def __init__(self, lists, function, basement):

        self.n = len(lists)

        self.K = (self.n-1).bit_length()

        self.func = function

        self.basement = basement

        self.seg = [basement]*2**(self.K+1)



        for i in range(self.n):

            self.seg[i+2**self.K-1] = lists[i]



        for i in range(2**(self.K)-2, -1, -1):

            self.seg[i] = self.func(self.seg[2*i+1], self.seg[2*i+2])



    def update(self, k, value):

        # 0-indexでa[k]の値をvalueに変更

        k += 2**self.K-1

        self.seg[k] = value

        while k:

            k = (k-1)//2

            self.seg[k] = self.func(self.seg[k*2+1], self.seg[k*2+2])



    def query(self, p, q):

        # 0-indexで[p,q)の値を取得する

        if q <= p:

            return self.basement

        num = 2**self.K

        p += num-1

        q += num-2

        res = self.basement

        while q-p > 1:

            if p & 1 == 0:

                res = self.func(res, self.seg[p])

            if q & 1 == 1:

                res = self.func(res, self.seg[q])

                q -= 1

            p = p//2

            q = (q-1)//2

        if p == q:

            res = self.func(res, self.seg[p])

        else:

            res = self.func(self.func(res, self.seg[p]), self.seg[q])

        return res





#gcd on blackboard

#セグ木（区間gcd) verify

from fractions import gcd

N=int(eval(input()))

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

seg=SegTree(A,gcd,0)

ans=1

for i in range(-1,N):

    v=gcd(seg.query(0,i),seg.query(i+1,N))

    ans=max(v,ans)

print(ans)

class SegTree():

    def __init__(self, lists, function, basement):

        self.n = len(lists)

        self.K = (self.n-1).bit_length()

        self.f = function

        self.b = basement

        self.seg = [basement]*2**(self.K+1)

        X = 2**self.K

        for i, v in enumerate(lists):

            self.seg[i+X-1] = v



        for i in range(2*X-2, 0, -2):

            self.seg[(i-1) >> 1] = self.f(self.seg[i], self.seg[i-1])



    def update(self, k, value):

        X = 2**self.K

        k += X-1

        self.seg[k] = value

        while k:

            k = (k-1) >> 1

            self.seg[k] = self.f(self.seg[(k << 1)+1], self.seg[(k << 1)+2])



    def query(self, L, R):

        num = 2**self.K-1

        L += num

        R += num

        vL = self.b

        vR = self.b

        while L < R:

            if L & 1 == 0:

                vL = self.f(vL, self.seg[L])

                L += 1

            if R & 1 == 0:

                R -= 1

                vR = self.f(self.seg[R], vR)

            L >>= 1

            R >>= 1

        return self.f(vL, vR)





#gcd on blackboard

#セグ木（区間gcd) verify

from fractions import gcd

N=int(eval(input()))

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

seg=SegTree(A,gcd,0)

ans=1

for i in range(-1,N):

    v=gcd(seg.query(0,i),seg.query(i+1,N))

    ans=max(v,ans)

print(ans)

# セグメント木。区間における要素の取得をO(logN)で行うことが可能である。
class SegTree:
    def __init__(self, lists, function, basement):
        self.n = len(lists)
        self.K = (self.n - 1).bit_length()
        self.func = function
        self.basement = basement
        self.seg = [basement] * 2 ** (self.K + 1)
        for i in range(self.n):
            self.seg[i + 2**self.K - 1] = lists[i]
        for i in range(2 ** (self.K) - 2, -1, -1):
            self.seg[i] = self.func(self.seg[2 * i + 1], self.seg[2 * i + 2])

    def update(self, k, value):
        # 0-indexでa[k]の値をvalueに変更
        k += 2**self.K - 1
        self.seg[k] = value
        while k:
            k = (k - 1) // 2
            self.seg[k] = self.func(self.seg[k * 2 + 1], self.seg[k * 2 + 2])

    def query(self, p, q):
        # 0-indexで[p,q)の値を取得する
        if q <= p:
            return self.basement
        num = 2**self.K
        p += num - 1
        q += num - 2
        res = self.basement
        while q - p > 1:
            if p & 1 == 0:
                res = self.func(res, self.seg[p])
            if q & 1 == 1:
                res = self.func(res, self.seg[q])
                q -= 1
            p = p // 2
            q = (q - 1) // 2
        if p == q:
            res = self.func(res, self.seg[p])
        else:
            res = self.func(self.func(res, self.seg[p]), self.seg[q])
        return res


# gcd on blackboard
# セグ木（区間gcd) verify
from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
seg = SegTree(A, gcd, 0)
ans = 1
for i in range(-1, N):
    v = gcd(seg.query(0, i), seg.query(i + 1, N))
    ans = max(v, ans)
print(ans)

class SegTree:
    def __init__(self, lists, function, basement):
        self.n = len(lists)
        self.K = (self.n - 1).bit_length()
        self.f = function
        self.b = basement
        self.seg = [basement] * 2 ** (self.K + 1)
        X = 2**self.K
        for i, v in enumerate(lists):
            self.seg[i + X - 1] = v
        for i in range(2 * X - 2, 0, -2):
            self.seg[(i - 1) >> 1] = self.f(self.seg[i], self.seg[i - 1])

    def update(self, k, value):
        X = 2**self.K
        k += X - 1
        self.seg[k] = value
        while k:
            k = (k - 1) >> 1
            self.seg[k] = self.f(self.seg[(k << 1) + 1], self.seg[(k << 1) + 2])

    def query(self, L, R):
        num = 2**self.K - 1
        L += num
        R += num
        vL = self.b
        vR = self.b
        while L < R:
            if L & 1 == 0:
                vL = self.f(vL, self.seg[L])
                L += 1
            if R & 1 == 0:
                R -= 1
                vR = self.f(self.seg[R], vR)
            L >>= 1
            R >>= 1
        return self.f(vL, vR)


# gcd on blackboard
# セグ木（区間gcd) verify
from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
seg = SegTree(A, gcd, 0)
ans = 1
for i in range(-1, N):
    v = gcd(seg.query(0, i), seg.query(i + 1, N))
    ans = max(v, ans)
print(ans)

-# セグメント木。区間における要素の取得をO(logN)で行うことが可能である。 -        self.func = function -        self.basement = basement +        self.f = function +        self.b = basement -        for i in range(self.n): -            self.seg[i + 2**self.K - 1] = lists[i] -        for i in range(2 ** (self.K) - 2, -1, -1): -            self.seg[i] = self.func(self.seg[2 * i + 1], self.seg[2 * i + 2]) +        X = 2**self.K +        for i, v in enumerate(lists): +            self.seg[i + X - 1] = v +        for i in range(2 * X - 2, 0, -2): +            self.seg[(i - 1) >> 1] = self.f(self.seg[i], self.seg[i - 1]) -        # 0-indexでa[k]の値をvalueに変更 -        k += 2**self.K - 1 +        X = 2**self.K +        k += X - 1 -            k = (k - 1) // 2 -            self.seg[k] = self.func(self.seg[k * 2 + 1], self.seg[k * 2 + 2]) +            k = (k - 1) >> 1 +            self.seg[k] = self.f(self.seg[(k << 1) + 1], self.seg[(k << 1) + 2]) -    def query(self, p, q): -        # 0-indexで[p,q)の値を取得する -        if q <= p: -            return self.basement -        num = 2**self.K -        p += num - 1 -        q += num - 2 -        res = self.basement -        while q - p > 1: -            if p & 1 == 0: -                res = self.func(res, self.seg[p]) -            if q & 1 == 1: -                res = self.func(res, self.seg[q]) -                q -= 1 -            p = p // 2 -            q = (q - 1) // 2 -        if p == q: -            res = self.func(res, self.seg[p]) -        else: -            res = self.func(self.func(res, self.seg[p]), self.seg[q]) -        return res +    def query(self, L, R): +        num = 2**self.K - 1 +        L += num +        R += num +        vL = self.b +        vR = self.b +        while L < R: +            if L & 1 == 0: +                vL = self.f(vL, self.seg[L]) +                L += 1 +            if R & 1 == 0: +                R -= 1 +                vR = self.f(self.seg[R], vR) +            L >>= 1 +            R >>= 1 +        return self.f(vL, vR)