#include <iostream>
#include <bits/stdc++.h>
#include <vector>

using namespace std;

int main()
{
    int n,summ;
    vector <int> a;
    cin >> n;
    a.resize(n);
    for (int i=0; i<n; ++i)
    {
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    for (int i=n-1; i>=0; --i)
    {
        if (a[i]==0)
            break;
        summ=summ + a[i];
        for (int j=0; j<i; ++j)
        {
            if ((a[j]>0) && (a[j]!=a[i]))
                a[j]=a[j]-1;
        }
        /*for (int i=0; i<n; ++i)
        {
            cout << a[i] << " ";
        }
        cout << endl;
        cout << summ << " ";*/
    }
    cout << summ;
    return 0;
}
