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

int balls[100005];

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

	int n;
	cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> balls[i];
    sort(balls, balls + n);
    int i = balls[n - 1], result = 0;
    while (i >= 0 && balls[i] > 0)
    {
        result += balls[i];
        for (int j = 0; balls[j] != balls[i]; ++j)
            --balls[j];
        --i;
    }
    cout << result << '\n';
}
