class Segtree:

    def __init__(self, original, func, element):

        self.n = len(original)

        self.element = element

        self.func = func

        self.N0 = 1 << (n-1).bit_length()

        self.seg = [element]*(self.N0 << 1)

        for i, j in enumerate(original, self.N0):

            self.seg[i] = j

        for i in range(self.N0-1, 0, -1):

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



    def get(self, i):

        return self.seg[i+self.N0]

        

    def update(self, i, x):

        i += self.N0

        self.seg[i] = x

        while i > 1:

            y = self.seg[i ^ 1]

            if y <= x:

              break

            i >>= 1

            x = self.func(x, y)

            self.seg[i] = x

                

    def query(self, l, r):

        res = self.element

        l += self.N0

        r += self.N0

        while l < r:

            if r & 1:

                res = self.func(res, self.seg[r-1])

            if l & 1:

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

                l += 1

            l >>= 1

            r >>= 1

     

        return res



    

import sys

input = sys.stdin.readline

from fractions import gcd

n = int(eval(input()))

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

seg = Segtree(A, gcd, 0)

ans = 0

for i in range(n):

  left = seg.query(0, i)

  right = seg.query(i+1, n)

  temp = gcd(left, right)

  ans = max(ans, temp)

print(ans)
class Segtree:

    def __init__(self, original, func, element):

        self.n = len(original)

        self.element = element

        self.func = func

        self.N0 = 1 << (n-1).bit_length()

        self.seg = [element]*(self.N0 << 1)

        for i, j in enumerate(original, self.N0):

            self.seg[i] = j

        for i in range(self.N0-1, 0, -1):

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



    def get(self, i):

        return self.seg[i+self.N0]

        

    def update(self, i, x):

        i += self.N0

        self.seg[i] = x

        while i > 1:

            y = self.seg[i ^ 1]

            i >>= 1

            x = self.func(x, y)

            self.seg[i] = x

                

    def query(self, l, r):

        res = self.element

        l += self.N0

        r += self.N0

        while l < r:

            if r & 1:

                res = self.func(res, self.seg[r-1])

            if l & 1:

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

                l += 1

            l >>= 1

            r >>= 1

     

        return res



    

import sys

input = sys.stdin.readline

from fractions import gcd

n = int(eval(input()))

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

seg = Segtree(A, gcd, 0)

ans = 0

for i in range(n):

  left = seg.query(0, i)

  right = seg.query(i+1, n)

  temp = gcd(left, right)

  ans = max(ans, temp)

print(ans)
class Segtree:
    def __init__(self, original, func, element):
        self.n = len(original)
        self.element = element
        self.func = func
        self.N0 = 1 << (n - 1).bit_length()
        self.seg = [element] * (self.N0 << 1)
        for i, j in enumerate(original, self.N0):
            self.seg[i] = j
        for i in range(self.N0 - 1, 0, -1):
            self.seg[i] = func(self.seg[2 * i], self.seg[2 * i + 1])

    def get(self, i):
        return self.seg[i + self.N0]

    def update(self, i, x):
        i += self.N0
        self.seg[i] = x
        while i > 1:
            y = self.seg[i ^ 1]
            if y <= x:
                break
            i >>= 1
            x = self.func(x, y)
            self.seg[i] = x

    def query(self, l, r):
        res = self.element
        l += self.N0
        r += self.N0
        while l < r:
            if r & 1:
                res = self.func(res, self.seg[r - 1])
            if l & 1:
                res = self.func(res, self.seg[l])
                l += 1
            l >>= 1
            r >>= 1
        return res


import sys

input = sys.stdin.readline
from fractions import gcd

n = int(eval(input()))
A = list(map(int, input().split()))
seg = Segtree(A, gcd, 0)
ans = 0
for i in range(n):
    left = seg.query(0, i)
    right = seg.query(i + 1, n)
    temp = gcd(left, right)
    ans = max(ans, temp)
print(ans)

class Segtree:
    def __init__(self, original, func, element):
        self.n = len(original)
        self.element = element
        self.func = func
        self.N0 = 1 << (n - 1).bit_length()
        self.seg = [element] * (self.N0 << 1)
        for i, j in enumerate(original, self.N0):
            self.seg[i] = j
        for i in range(self.N0 - 1, 0, -1):
            self.seg[i] = func(self.seg[2 * i], self.seg[2 * i + 1])

    def get(self, i):
        return self.seg[i + self.N0]

    def update(self, i, x):
        i += self.N0
        self.seg[i] = x
        while i > 1:
            y = self.seg[i ^ 1]
            i >>= 1
            x = self.func(x, y)
            self.seg[i] = x

    def query(self, l, r):
        res = self.element
        l += self.N0
        r += self.N0
        while l < r:
            if r & 1:
                res = self.func(res, self.seg[r - 1])
            if l & 1:
                res = self.func(res, self.seg[l])
                l += 1
            l >>= 1
            r >>= 1
        return res


import sys

input = sys.stdin.readline
from fractions import gcd

n = int(eval(input()))
A = list(map(int, input().split()))
seg = Segtree(A, gcd, 0)
ans = 0
for i in range(n):
    left = seg.query(0, i)
    right = seg.query(i + 1, n)
    temp = gcd(left, right)
    ans = max(ans, temp)
print(ans)

-            if y <= x: -                break