#include <bits/stdc++.h>

#define ll long long
#define us unsigned short
#define ui unsigned int

using namespace std;

ui n;
vector<ui> a;
ui used_range;
ll money = 0;

void update_vector() {
    for (int i=n-1; i >= 0; i--) {
        if (a[i] != used_range && a[i] > 0)
            a[i]--;
    }
}

int main() {
    cin >> n;
    ui elem;
    for (int i=0; i < n; i++) {
        cin >> elem;
        a.push_back(elem);
    }

    sort(a.begin(), a.end());

    while (accumulate(a.begin(), a.end(), 0) != 0) {
        used_range = a[a.size()-1];
        money += used_range;
        a.pop_back();
        n--;
        update_vector();
    }

    cout << money << '\n';

    return 0;
}
