N = int(input()) A = list(map(int, input().split())) print(sum(i for i in A if i - 1 not in A))