#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long int ans = 0;
  set<int> s;
  sort(a, a + n);
  ans = ans + a[n - 1];
  s.insert(a[n - 1]);
  for (int i = n - 2; i >= 0; i--) {
    while (s.find(a[i]) != s.end()) {
      a[i] = a[i] - 1;
    }
    if (a[i] > 0) {
      ans += a[i];
      s.insert(a[i]);
    }
  }
  cout << ans;
}
