#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, s = 0;
  map<long long, int> mp;
  cin >> n;
  while (n--) {
    long long k;
    cin >> k;
    while (mp[k] == 1 && k > 0) k--;
    mp[k] = 1;
    s += k;
  }
  cout << s << endl;
  return 0;
}
