using System;
using System.Collections.Generic;
using System.Linq;

class Solution {
  public static void Main(string[] args) {
        int n = Convert.ToInt32(Console.ReadLine());
        List<int> numbers = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse).ToList();
        numbers.Sort();
        int result = 0;
        while (numbers.Count > 1) 
        {
            int temp = 0;
            for (int i = numbers.Count-1; i >= 0; i--)
            {
                if (i == numbers.Count-1)
                {
                    result += numbers[i];
                    temp = numbers[i];
                    numbers[i] = 0;
                }
                else if (!(numbers[i] == temp))
                    numbers[i]--;
            }
            numbers = numbers.Where(x => x > 0).ToList();
        }
        result += numbers[0];
        Console.WriteLine(result);
  }
}
