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 do():
    global c
    max_ = max(boxes)
    count = boxes[max_]
    c += count * max_
    del boxes[max_]
    tmp = boxes.copy()
    for i in tmp:
        boxes[i-count] = boxes[i]
        del boxes[i]

while len(boxes) > 0:
    do()
    if 1 in boxes:
        del boxes[1]


print(c)