#include<iostream>
using namespace std;
#define ll long long

ll cubes[1001] = {0};

int main () {
    ll n, max_num = 0, removed = 0, ans = 0;
    cin >> n;

    for (ll i = 0; i < n; i++) {
        ll temp;
        cin >> temp;
        cubes[temp]++;
        max_num = max(temp, max_num);
    }


    for (ll i = max_num; i >= 0; i--) {
        cubes[i] = max(cubes[i] - removed, (ll)(0));
        removed += cubes[i];
    }

    for (ll i = 1; i <= max_num; i++) {
        ans += cubes[i] * i;
    }
    cout << ans;
}
