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

int n, e;
long long money = 0;
vector <int> v;

void erss(){
    int a = v[0];
    v.erase(v.begin());

    for (int i = 0; i < v.size(); i++){
        if (v[i] != a){
            v[i] -= 1;
        }
    }
    money += a;
    }

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

	cin >> n;
    for (int i = 0 ; i < n; i++){
        cin >> e;
        v.push_back(e);
    }

    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    while (v[0] > 0){
        erss();
    }
    
   /* for (int i = 0; i < v.size(); i++){
        cout << v[i] << " ";
    }*/
    cout << money;
}
