Buggy python submission (verdict: Runtime Error):
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    n = int(sys.stdin.readline())
    A = sorted(list(map(int, sys.stdin.readline().split())))
    if n==2:
        print(gcd(*A))
    else:
        ans = gcd(*A[1:n])
        p = A.pop(1)
        temp_ans = gcd(*A)
        if temp_ans > ans:
            ans = temp_ans
        print(ans)

    # else:
    #     ans = gcd(*A[1:n])
    #     for i in range(n):
    #         p = A.pop(i)
    #         temp_ans = gcd(*A)
    #         if temp_ans > ans:
    #             ans = temp_ans
    #         A.insert(i,p)
    #     print(ans)

Fixed submission:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))

    #累積GCD
    left = [0]*n
    right = [0]*n

    for i in range(n-1):
        left[i+1] = gcd(left[i],a[i])
        right[-i-2] = gcd(right[-i-1],a[-i-1])
        # print("left:",left)
        # print("right:",right)

    gcd_t = 1
    for i in range(n):
        gcd_t = max(gcd_t,gcd(left[i],right[i]))
    print(gcd_t)

Buggy python submission (verdict: Runtime Error):
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    n = int(sys.stdin.readline())
    A = list(map(int, sys.stdin.readline().split()))
    if n==2:
        print(gcd(*A))
    else:
        ans = gcd(*A[1:n])
        for i in range(n):
            p = A.pop(i)
            temp_ans = gcd(*A)
            if temp_ans > ans:
                ans = temp_ans
            A.insert(i,p)
        print(ans)

Fixed submission:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))

    #累積GCD
    left = [0]*n
    right = [0]*n

    for i in range(n-1):
        left[i+1] = gcd(left[i],a[i])
        right[-i-2] = gcd(right[-i-1],a[-i-1])
        # print("left:",left)
        # print("right:",right)

    gcd_t = 1
    for i in range(n):
        gcd_t = max(gcd_t,gcd(left[i],right[i]))
    print(gcd_t)