#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
long long int fexpo(long long int a, long long int b) {
  if (b == 0) return 1LL;
  if (b == 1) return a;
  if (b == 2) return a * a;
  if (b % 2 == 0)
    return fexpo(fexpo(a, b / 2), 2);
  else
    return a * fexpo(fexpo(a, (b - 1) / 2), 2);
}
int ar[10101010];
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  sort(ar, ar + n);
  long long int ans = ar[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    if (ar[i] > ar[i + 1]) {
      ar[i] = ar[i + 1];
    }
    while (ar[i] >= ar[i + 1] && ar[i]) {
      ar[i]--;
    }
    if (ar[i] >= 0) ans += ar[i];
  }
  cout << ans << endl;
}
int main() { solve(); }
