#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, a;
  cin >> n;
  unsigned long long res = 0;
  map<unsigned long long, unsigned long long> m;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (!m.count(a)) {
      res += a;
      m[a] = a;
    } else {
      while (m.count(a) && a > 0) a--;
      if (a > 0) m[a] = a;
      res += a;
    }
  }
  cout << res << endl;
  return 0;
}
