#include <bits/stdc++.h>
using namespace std;
int main() {
  set<int> m;
  unsigned long long s = 0;
  set<int>::iterator it;
  int n, x;
  cin >> n;
  while (n--) {
    cin >> x;
    if (m.find(x) == m.end())
      m.insert(x);
    else
      while (m.find(x) != m.end()) x--;
    if (x != 0) m.insert(x);
  }
  for (it = m.begin(); it != m.end(); it++) s += *it;
  cout << s;
}
