a=[] i=0 k=int(input()) a=input().split() a.sort() p=a[0] while i==k-2: if a[i]+1!=a[i+1]: p+=a[i+1] print(p)