#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, ans = 0;
  cin >> n;
  long long ar[n];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  sort(ar, ar + n);
  reverse(ar, ar + n);
  ans += ar[0];
  for (int i = 1; i < n; i++) {
    while (ar[i] >= ar[i - 1]) {
      ar[i]--;
    }
    ans += max(0ll, ar[i]);
  }
  cout << ans << "\n";
}
