#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int a[N], n;
int main() {
  while (scanf("%d", &n) == 1) {
    for (int i = 0; i < (n); ++i) scanf("%d", a + i);
    sort(a, a + n);
    int pre = a[n - 1] + 1;
    long long ans = 0;
    for (int i = n - 1; i >= 0; --i) {
      if (pre > a[i])
        ans += a[i], pre = a[i];
      else if (pre)
        ans += --pre;
    }
    cout << ans << endl;
  }
  return 0;
}
