n = int(input()) A = list(map(int, input().split())) from collections import Counter C = Counter(A) M = max(A) X = [0]*n for g in range(1, M+1): j = g cnt = 0 while j <= M: cnt += C[j] j += g if cnt != 0: X[n-cnt] = g ans = 1 for i in range(n): ans = max(ans, X[i]) print(ans)