#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
  int n,s=0,s1=0,ans=0;
  cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)
    {
    cin>>v[i];
    }
sort(v.rbegin(),v.rend());
for(int i=0;i<n;i++)
    {
    if(v[i]>v[i+1] ) {v[i]-=s;s1++;s+=s1;s1=0;}
    else
        {
        v[i]-=s;
        s1++;
        }
    }
for(int i=0;i<n;i++)
    if(v[i]>=0)ans+=v[i];
cout<<ans;
}

