a = int(input()) b = list(map(int, input().split())) b.sort() c = 0 for i in b: if i - 1 not in b: c += i print(c)