from collections import Counter

from functools import reduce

import bisect

import copy

import fractions

import math

# import statistics

import sys

import time

sys.setrecursionlimit(10**7)

INF = 10 ** 18

MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]

def LF(): return [float(x) for x in sys.stdin.readline().split()]

def LS(): return sys.stdin.readline().split()

def MI(): return map(int, sys.stdin.readline().split())

def II(): return int(sys.stdin.readline())

def IS(): return input()

def P(x): return print(x)

def C(x): return Counter(x)

def GCD_LIST(numbers):

    return reduce(fractions.gcd, numbers)

def LCM_LIST(numbers):

    return reduce(LCM, numbers)

def LCM(m, n):

    return (m * n // fractions.gcd(m, n))





def update(i, x, seg):

    i = len(a) + i - 1

    seg[i] = x

    while i > 0:

        i = math.floor((i-1) / 2)  # 上のノード

        # seg[i] = min(seg[2*i + 1], seg[2*i + 2])

        seg[i] = fractions.gcd(seg[2*i + 1], seg[2*i + 2])

    # 数列の1要素を変更可能＞消去で良い＞1要素を0に置換しても良い

    # 1要素を0にした時のリスト全体の最大公約数を今回は返す

    return seg[0]





n, a = II(), LI()

# 最大公約数を求める。gcd(0, x) = 0なので各要素を0で初期化する

segtree = [0] * (2*n -1)

maxi = 0



# node n, parent floor((n-1)/2), chile 2*n + 1 2*n + 2

for i in range(n):

    update(i, a[i], segtree)



for i in range(n):

    maxi = max(maxi, update(i, 0, segtree))

    # 元に戻す...???

    update(i, a[i], segtree)



print(maxi)

from collections import Counter

from functools import reduce

# import statistics

import bisect

import copy

import fractions

import math

import random

import string

import sys

import time

sys.setrecursionlimit(10**7)

INF = 10 ** 18

MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]

def LF(): return [float(x) for x in sys.stdin.readline().split()]

def LS(): return sys.stdin.readline().split()

def MI(): return list(map(int, sys.stdin.readline().split()))

def II(): return int(sys.stdin.readline())

def IS(): return eval(input())

def C(x): return Counter(x)

def GCD_LIST(numbers):

    return reduce(fractions.gcd, numbers)

def LCM_LIST(numbers):

    return reduce(LCM, numbers)

def LCM(m, n):

    return (m * n // fractions.gcd(m, n))



def unite(x, y):

    # それぞれのノードの根を求める

    x = root(x)

    y = root(y)

    if x == y:

        return

    # node[x]の根をyに変更する

    node[x] = y

def same(x,y): return bool(root(x) == root(y))

def root(x):

    if node[x] == x:  # xが根の場合

        return x

    else:

        node[x] = root(node[x])  # 経路圧縮

        return node[x]



n = II()

a = LI()

left = [0] * (n+1)

right = [0] * (n+1)



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

    left[i] = fractions.gcd(left[i-1], a[i-1])

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

    right[i] = fractions.gcd(right[i+1],a[i])

maxi = -INF

for i in range(n):

    maxi = max(maxi, fractions.gcd(left[i], right[i+1]))

print(maxi)



from collections import Counter
from functools import reduce
import bisect
import copy
import fractions
import math

# import statistics
import sys
import time

sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def LF():
    return [float(x) for x in sys.stdin.readline().split()]


def LS():
    return sys.stdin.readline().split()


def MI():
    return map(int, sys.stdin.readline().split())


def II():
    return int(sys.stdin.readline())


def IS():
    return input()


def P(x):
    return print(x)


def C(x):
    return Counter(x)


def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)


def LCM_LIST(numbers):
    return reduce(LCM, numbers)


def LCM(m, n):
    return m * n // fractions.gcd(m, n)


def update(i, x, seg):
    i = len(a) + i - 1
    seg[i] = x
    while i > 0:
        i = math.floor((i - 1) / 2)  # 上のノード
        # seg[i] = min(seg[2*i + 1], seg[2*i + 2])
        seg[i] = fractions.gcd(seg[2 * i + 1], seg[2 * i + 2])
    # 数列の1要素を変更可能＞消去で良い＞1要素を0に置換しても良い
    # 1要素を0にした時のリスト全体の最大公約数を今回は返す
    return seg[0]


n, a = II(), LI()
# 最大公約数を求める。gcd(0, x) = 0なので各要素を0で初期化する
segtree = [0] * (2 * n - 1)
maxi = 0
# node n, parent floor((n-1)/2), chile 2*n + 1 2*n + 2
for i in range(n):
    update(i, a[i], segtree)
for i in range(n):
    maxi = max(maxi, update(i, 0, segtree))
    # 元に戻す...???
    update(i, a[i], segtree)
print(maxi)

from collections import Counter
from functools import reduce

# import statistics
import bisect
import copy
import fractions
import math
import random
import string
import sys
import time

sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7


def LI():
    return [int(x) for x in sys.stdin.readline().split()]


def LF():
    return [float(x) for x in sys.stdin.readline().split()]


def LS():
    return sys.stdin.readline().split()


def MI():
    return list(map(int, sys.stdin.readline().split()))


def II():
    return int(sys.stdin.readline())


def IS():
    return eval(input())


def C(x):
    return Counter(x)


def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)


def LCM_LIST(numbers):
    return reduce(LCM, numbers)


def LCM(m, n):
    return m * n // fractions.gcd(m, n)


def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y


def same(x, y):
    return bool(root(x) == root(y))


def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]


n = II()
a = LI()
left = [0] * (n + 1)
right = [0] * (n + 1)
for i in range(1, n + 1):
    left[i] = fractions.gcd(left[i - 1], a[i - 1])
for i in range(n - 1, -1, -1):
    right[i] = fractions.gcd(right[i + 1], a[i])
maxi = -INF
for i in range(n):
    maxi = max(maxi, fractions.gcd(left[i], right[i + 1]))
print(maxi)

+ +# import statistics - -# import statistics +import random +import string -    return map(int, sys.stdin.readline().split()) +    return list(map(int, sys.stdin.readline().split())) -    return input() - - -def P(x): -    return print(x) +    return eval(input()) -def update(i, x, seg): -    i = len(a) + i - 1 -    seg[i] = x -    while i > 0: -        i = math.floor((i - 1) / 2)  # 上のノード -        # seg[i] = min(seg[2*i + 1], seg[2*i + 2]) -        seg[i] = fractions.gcd(seg[2 * i + 1], seg[2 * i + 2]) -    # 数列の1要素を変更可能＞消去で良い＞1要素を0に置換しても良い -    # 1要素を0にした時のリスト全体の最大公約数を今回は返す -    return seg[0] +def unite(x, y): +    # それぞれのノードの根を求める +    x = root(x) +    y = root(y) +    if x == y: +        return +    # node[x]の根をyに変更する +    node[x] = y -n, a = II(), LI() -# 最大公約数を求める。gcd(0, x) = 0なので各要素を0で初期化する -segtree = [0] * (2 * n - 1) -maxi = 0 -# node n, parent floor((n-1)/2), chile 2*n + 1 2*n + 2 +def same(x, y): +    return bool(root(x) == root(y)) + + +def root(x): +    if node[x] == x:  # xが根の場合 +        return x +    else: +        node[x] = root(node[x])  # 経路圧縮 +        return node[x] + + +n = II() +a = LI() +left = [0] * (n + 1) +right = [0] * (n + 1) +for i in range(1, n + 1): +    left[i] = fractions.gcd(left[i - 1], a[i - 1]) +for i in range(n - 1, -1, -1): +    right[i] = fractions.gcd(right[i + 1], a[i]) +maxi = -INF -    update(i, a[i], segtree) -for i in range(n): -    maxi = max(maxi, update(i, 0, segtree)) -    # 元に戻す...??? -    update(i, a[i], segtree) +    maxi = max(maxi, fractions.gcd(left[i], right[i + 1]))