n = int(input()) l = list(map(int,input().split())) a = 0 for i in l: a += (i-1 not in l)*i print(a)