n = int(input()) a = list(map(int,input().split())) from collections import defaultdict d = defaultdict(int) import math # ans = a[0] for i in range(n): l = [] # if i >= 1: # ans = math.gcd(ans,a[i]) for j in range(1,int(a[i] ** (1/2)) + 1): if a[i] % j == 0: l.append(j) l.append(a[i]//j) for j in l: d[j] += 1 d2 = defaultdict(int) for k in d.keys(): d2[d[k]] = max(d2[d[k]],k) ans = 1 for i in range(n): if (n-i) in d2: ans = d2[n-i] print(ans)