n=int(input()) l=input().split() l=[int(i)for i in l] a=[] for i in range(n): if not(l[i]-1 in l): a+=[l[i]] print(sum(a))