n=int(input()) l=[int(x) for x in input().split()] l.sort() nl=[] for i in range(n): if not (l[i]-1 in l): nl.append(l[i]) print(sum(nl))