#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a + n);
  reverse(a, a + n);
  long long int res = a[0];
  for (int i = 1; i < n; i++) {
    if (a[i] >= a[i - 1]) {
      res += a[i - 1] - 1;
      a[i] = a[i - 1] - 1;
      if (a[i] == 0) break;
    } else
      res += a[i];
  }
  printf("%lld", res);
  return 0;
}
