n=int(input()) a=list(map(int,input().split())) a.sort(reverse=True) k=0 idx=0 ans=0 while True: for i in range(1<