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