#include <bits/stdc++.h>
using namespace std;
map<long long int, int> mymap;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int sum = 0;
  long long int k;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> k;
    while (mymap[k] == 1 && k > 0) {
      k--;
    }
    mymap[k] = 1;
    sum += k;
  }
  cout << sum << "\n";
  return 0;
}
