#include <bits/stdc++.h>
using namespace std;
map<long long, long long> m;
int main() {
  int n;
  long long temp;
  cin >> n;
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    cin >> temp;
    int toAdd = temp;
    while (toAdd > 0 && m.count(toAdd)) {
      toAdd--;
    }
    if (toAdd != 0) {
      m[toAdd] = 1;
      sum += toAdd;
    }
  }
  cout << sum;
  return 0;
}
