#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int mod = 1e9 + 7;
const int inf = 1061109567;
const int dir[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
map<int, int> mp;
int main() {
  int n, x;
  long long ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    while (mp[x] && x) {
      x--;
    }
    mp[x] = 1;
    ans += x;
  }
  cout << ans << endl;
  return 0;
}
