#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, j, s = 0, m = 0;
  cin >> n;
  long long int a[n];
  for (i = 0; i < n; ++i) cin >> a[i];
  sort(a, a + n);
  for (i = n - 1; i >= 0 && a[i]; --i) {
    for (j = i - 1; a[j] == a[i]; --j) a[j]--;
    s += a[i];
  }
  cout << s;
}
