#include <bits/stdc++.h>
using namespace std;
unsigned long long p[10000];
vector<int> q;
unsigned long long a[2000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  unsigned long long in = 0;
  unsigned long long ans = 0;
  for (int i = n - 1; i > -1; i--) {
    if (i == n - 1) {
      in = a[i] - 1;
      ans += a[i];
    } else if (a[i] <= in) {
      ans += a[i];
      in = a[i] - 1;
    } else if (in > 0) {
      ans += in;
      in--;
    }
  }
  cout << ans << endl;
}
