#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const double PI = 3.141592653589793238463;
bool comp(string a, string b) { return a.length() < b.length(); }
map<int, bool> m;
int main() {
  long long x;
  cin >> x;
  long long arr[x];
  for (long long i = 0; i < x; ++i) {
    cin >> arr[i];
  }
  sort(arr, arr + x, greater<int>());
  long long ans = arr[0];
  m[arr[0]] = true;
  int c = 0;
  for (long long j = 1; j < x;) {
    if (m[arr[j]]) {
      arr[j]--;
    } else {
      if (arr[j] > 0) ans += arr[j];
      m[arr[j]] = true;
      j++;
    }
  }
  cout << ans << '\n';
  return 0;
}
