from sys import stdin input=lambda :stdin.readline()[:-1] n=int(input()) a=list(map(int,input().split())) ans=10**9 ans2=-1 import bisect for x in range(1,2*n+1): now=0 i=0 while i!=n: now+=x+1 if now>=ans: break i=bisect.bisect_left(a,(a[i]//x+1)*x) if now