def calc(x): score=1 for i in range(1,N): if A[i]//x!=A[i-1]//x: score+=1 return score*(x+1) def calc2(x): score=1 now=A[0]//x OK=0 while True: NG=len(A) while NG>OK+1: mid=(OK+NG)//2 if A[mid]//x==now: OK=mid else: NG=mid if NG==len(A): break else: score+=1 now=A[NG]//x OK=NG return score*(x+1) N=int(input()) A=list(map(int,input().split())) ANS=1<<100 IND=-1 for i in range(1,100): k=calc(i) if k