N = int(input()) A = list(map(int,input().split())) cnt = [0]*(max(A)+1) for a in A: cnt[a] += 1 ans = [1]*(N+1) mA = max(A) for i in range(1,mA+1): tmp = 0 for c in cnt[::i]: tmp += c ans[tmp] = max(i,ans[tmp]) tmp = 1 for i in range(N): tmp = max(tmp,ans[-1-i]) print(tmp)