#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    long long sum = 0;
    cin >> n;
    vector<int> v;
    for (int i = 0; i < n; i++) {
        int number;
        cin >> number;
        v.push_back(number);
    }
    sort(v.begin(), v.end());
    for (int place = v.size() - 1; place > 0; place--) {
        int i = 0;
        while (v[i] < v[place]) {
            if (v[i] > 0)
                v[i]--;
            i++;
        }
        sum += v[place];
    }
    cout << sum;
}