#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long int> v;
  for (int i = 0; i < n; i++) {
    long long int temp;
    cin >> temp;
    v.push_back(temp);
  }
  sort(v.begin(), v.end());
  for (int i = v.size() - 1; i > 0; i--) {
    if (v[i] <= v[i - 1]) {
      v[i - 1] = v[i] - 1;
    }
  }
  long long int sum = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] > 0) sum += v[i];
  }
  if (sum <= 0)
    cout << 1;
  else
    cout << sum << endl;
  return 0;
}
