#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i = 0;
  cin >> n;
  long long a;
  vector<long long> vc;
  while (n--) {
    cin >> a;
    vc.push_back(a);
  }
  sort(vc.begin(), vc.end());
  i = vc.size();
  long long ans = vc[i - 1];
  for (int j = i - 2; j >= 0; j--) {
    if (vc[j] >= vc[j + 1]) {
      vc[j] = vc[j + 1] - 1;
    }
    if (vc[j] > 0) ans += vc[j];
  }
  cout << ans << endl;
}
