#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int x, n, i;
  unsigned long long int sum = 0;
  unordered_map<int, int> m;
  priority_queue<int> pq;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    pq.push(x);
  }
  while (!pq.empty()) {
    x = pq.top();
    pq.pop();
    while (m[x] != 0) {
      x--;
    }
    if (x > 0) {
      sum += x;
      m[x]++;
    }
  }
  cout << sum;
  return 0;
}
