#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  set<long long> st;
  long long ans = 0;
  st.insert(a[0]);
  ans += a[0];
  for (long long i = 1; i < n; i++) {
    if (st.find(a[i]) == st.end()) {
      st.insert(a[i]);
      ans += a[i];
    } else {
      while (true) {
        if (st.find(a[i]) == st.end() || a[i] == 0) {
          ans += a[i];
          st.insert(a[i]);
          break;
        }
        --a[i];
      }
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
}
