n = int(input())
i = list(map(int, input().split()))
p = 0
y = max(i)
while n != 0:
    x = max(i)
    p = p + int(max(i))
    i.remove(max(i))
    n = n-1
    for t in range(n):
        if i[t] == 0:
            i.pop(t)
            n = n-1
            continue
        if i[t] < x:
            i[t] = i[t] - 1
        else:
            continue

print(p)