#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> v;
  int n;
  cin >> n;
  v.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.rbegin(), v.rend());
  long long ans = v[0];
  for (int i = 1; i < n; i++) {
    if (v[i] >= v[i - 1]) v[i] = max(v[i - 1] - 1, 0LL);
    ans += v[i];
  }
  cout << ans;
}
