n = int(input())
m = [int(i) for i in input().split()]
m.reverse()
k = m[:]
c = 1
for i in range(n):
    v = max(k)
    c += v
    k.remove(v)
    for j in range(len(k)):
        if k[j] != v:
            k[j] -= 1

print(c)
