n = int(input())
a = list(map(int, input().split()))
c = 0

boxes = {}
for i in a:
    if i in boxes:
        boxes[i] += 1
    else:
        boxes[i] = 1

def change():
    global boxes, c
    c += max(boxes)
    tmp = boxes.copy()
    for i in boxes:
        if i == max(boxes):
            boxes[i] -= 1
        if i == 1:
            del tmp[i]
        else:
            tmp[i-1] = tmp[i]
            del tmp[i]


    boxes = tmp
        

while len(boxes) > 1:
    change()
print(c)