#include <iostream>
#include <algorithm>

using namespace std;

long long n, k, s;

long long a[100007];

int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    k = n;
    for (int i = n; i >= 1; i--) {
        s += a[i];
        a[i] = 0;
        for (int j = 1; j <= i; j++) {
            a[j]--;
        }
    }
    cout << s << endl;
}