#include <bits/stdc++.h>
using namespace ::std;
const long long OO = 1e9;
const long long OOL = 1e18;
const double EPS = (1e-7);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
const int N = 20;
vector<int> prime;
bool mat[1000001] = {0};
void generate_primes(int n) {
  prime.clear();
  prime.push_back(2);
  for (int i = 3; i * i <= n; i += 2) {
    if (mat[i] == 0) {
      for (int j = i * i; j < n; j += 2 * i) mat[j] = 1;
    }
  }
  for (int i = 3; i <= n; i += 2)
    if (!mat[i]) prime.push_back(i);
}
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  return (b == 0 ? a : gcd(b, a % b));
}
unsigned long long lcm(unsigned long long a, unsigned long long b) {
  return (a * (b / gcd(a, b)));
}
unsigned long long power(unsigned long long a, unsigned long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  unsigned long long ans = power(a, b / 2);
  ans = ans * ans;
  if (b % 2 != 0) ans *= a;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  long long res = 0;
  int n;
  cin >> n;
  map<int, int> freq;
  for (int i = 0; i < (int)(n); ++i) {
    int x;
    cin >> x;
    while (freq.find(x) != freq.end()) {
      x--;
    }
    if (x != 0) freq.insert(make_pair(x, 1));
  }
  for (map<int, int>::iterator it = freq.begin(); it != freq.end(); it++) {
    res += it->first;
  }
  cout << res;
  return 0;
}
