N=int(input()) p=[*map(int,input().split())] m=sum(n for n in p if n-1 not in p) print(m)