#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  vector<long long int> v;
  long long int x;
  for (long long int i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(), v.end());
  set<long long int> s;
  long long int ans = 0;
  for (long long int i = n - 1; i >= 0; i--) {
    while (v[i] > 0 && s.find(v[i]) != s.end()) v[i]--;
    ans += v[i];
    s.insert(v[i]);
  }
  cout << ans;
  return 0;
}
