#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <map>
#include <set>
#define MOD 1000000007
#define int long long
#define MAX 1000000000

using namespace std;

void solve()
{
	int n;
	cin >> n;
	vector<int> tst(n);
	vector<int> v;
	for (int i = 0; i < n; i++)
		cin >> tst[i];

	int maxel = *max_element(tst.begin(), tst.end());
	v.resize(maxel, 0);
	for (auto a : tst)
	{
		v[a - 1]++;
	}

	int s = 0;

	for (int i = v.size() - 1; i >= 0; i--)
	{
		if (v[i] != 0)
		{
			int x = v[i];
			for (int j = 0; j < x; j++)
			{
				v[i]--;
				s += i + 1;
				for (int k = 0; k <= i - 2; k++)
				{
					v[k] = v[k + 1];
				}
				v[i - 1] = 0;
			}
		}
	}
	cout << s << endl;
}

signed main()
{
	int t = 1;
	for (int i = 0; i < t; i++)
	{
		solve();
	}
}