#include<bits/stdc++.h>
#define int long long
#define ff first
#define ss second
using namespace std;
vector<long long>v;
vector<long long>v1;
set<long long>s;
multiset<long long>st;
map<long long, long long>mp;
const long long MOD=1e9+7;
long long n[1000005];
long long  n1[1000005];
char c1;
long long a, b, c, d,g, to,a1,ans0=0, ans = 0, ans1 = 0, e,mx, f, d1 = 1,ans7=0, ans2 = 0, ans3 = 0, ans4 = 0, ans5 = 0, ans6 = 0, x, y, z, ans111 = 1e6;
signed main()
{
    /*#ifndef __WIN32
    freopen("loganqueries.in","r", stdin);
    freopen("loganqueries.out","w", stdout);
    #endif*/
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //string s, s1;
    cin>>a;
    for(int i=0;i<a;i++)
    {
        cin>>n[i];
    }
    sort(n, n+a);
    reverse(n, n+a);
    for(int i=0;i<a;i++)
    {
        if(n[i]<0)break;
        ans=ans+n[i];
        for(int i1=i+1;i1<a;i1++)
        {
            if(n[i1]<n[i])n[i1]--;
        }
    }
    cout<<ans;
    return 0;
}
//381318232833
