#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long n;
    cin >> n;
    long long a[n] = {0};
    for (long long i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    long long summ = 0;
    for (long long i = n - 1; i >= 0; i--) {
        if (a[i] > 0) {
            summ += a[i];
            //cout << a[i] << " " << summ << endl; 
        }
        for (long long e = i; e >= 0; e--) {
            if (a[e] != a[i]) {
                a[e]--;
            }
        }
    }
    cout << summ;
}
