n=int(input()) a=list(map(int,input().split())) i=0 ans=0 a.sort() while i