#include <bits/stdc++.h>
using namespace std;
const long long MOD=10e9+7;
#define Std 100003
#define StdD 100007
#define StdINF 1000000007
#define endl "\n"
#define ll long long
#define ull unsigned long long
#define ld long double
#define st string
#define ch char
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define sl set<ll>
ll n,sum;
ll k[Std];
void vv(int i)
{
    for(int j=i-1;j>=1;j--)
    {
        if(k[j]!=k[i])k[j]--;
        if(k[j]<1)break;
    }
}
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]<1)break;
            sum+=k[i];
            vv(i);
        }
        cout<<sum;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    Start();

    return 0;
}
