n = int(input()) a = list(map(int, input().split())) ans = [] for i in range(n): for j in range(n): if a[i] - a[j] == 1: break else: ans.append(a[i]) print(sum(ans))