import sys from operator import itemgetter from collections import defaultdict, deque import heapq import bisect stdin=sys.stdin sys.setrecursionlimit(10 ** 8) ip=lambda: int(sp()) fp=lambda: float(sp()) lp=lambda:list(map(int,stdin.readline().split())) sp=lambda:stdin.readline().rstrip() Yp=lambda:print('Yes') Np=lambda:print('No') inf = 1 << 60 eps = 1e-9 sortkey = itemgetter(0) ############################################################### N = ip() A = lp() score = [0 for _ in range(50)] ans = 0 for get in A: score[get] += 1 for i in range(1,50): if score[i] == 1: if score[i - 1] == 0: ans += i print(ans)