#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  long long int rez = 0;
  for (int i = 0, pl = v[0] + 1; i < n; i++) {
    if (pl > v[i]) pl = v[i];
    rez += pl;
    pl--;
    if (!pl) break;
  }
  cout << rez;
}
