a = int(input())
sumsd = 0
n = list(map(int, input().split()))
n.sort()
while n != []:
	maxz = max(n)
	n.pop(len(n)-1)
	sumsd += maxz
	if n == []:
		break						
	for y in range(0, round(len(n)/2)):
		if n[y] == 1:
			n.pop(y)
		elif n[y] != maxz:
			n[y] -= 1
	for x in range(round(len(n)/2), len(n)):
		if n[x] == 1:
			n.pop(x)
		elif n[x] != maxz:
			n[x] -= 1		
print(sumsd)