#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  long long int maxi, sumi = 0;
  maxi = a[n - 1];
  sumi += maxi;
  for (int i = n - 2; i >= 0; i--) {
    if (a[i] < maxi) {
      maxi = a[i];
    } else {
      if (maxi <= 1)
        maxi = 0;
      else
        maxi = maxi - 1;
    }
    sumi += maxi;
  }
  cout << sumi << endl;
  return 0;
}
