a = int(input())
b = input().split()
c = []
for i in b:
    c.append(int(i))
c.sort()
k = 0
while c != []:
    k =k+ max(c)
    for i in range(len(c)):
        if c[i]!=max(c):
            c[i] = c[i]-1
    c.pop(-1)
    while 0 in c:
        c.remove(0)
print(k)
