#include <bits/stdc++.h>
using namespace std;
#define Std 100003
#define endl "\n"
#define ll long long
ll n,sum;
ll k[Std];
void Start()
{
cin>>n;
for(int i=1;i<=n;i++)
    {
    cin>>k[i];
    }
sort(k+1,k+n+1);
for(int i=n;i>=1;i--)
    {
        if(k[i]>=0)sum+=k[i];
        for(int j=i-1;j>=1;j--)
        {
            if(k[j]!=k[i])k[j]--;
        }
    }
    cout<<sum;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    Start();

    return 0;
}
