#include <bits/stdc++.h>
using namespace std;
bool reverseSort(long int a, long int b) { return (a > b); }
int main() {
  int n(0);
  cin >> n;
  vector<long int> a;
  long int temp(0);
  for (int i = 0; i < n; ++i) {
    cin >> temp;
    a.push_back(temp);
  }
  sort(a.begin(), a.end(), reverseSort);
  long int dupChar(a[0]);
  long long int maxLength(a[0]);
  for (int i = 1; i < n and dupChar > 0; ++i) {
    if (dupChar <= a[i]) {
      maxLength += dupChar - 1;
      --dupChar;
    } else {
      dupChar = a[i];
      maxLength += dupChar;
    }
  }
  cout << maxLength << '\n';
  return 0;
}
