#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int i = 0;
  long long int a[n];
  while (i != n) {
    cin >> a[i];
    i++;
  }
  i = 0;
  sort(a, a + n);
  long long int cnt = 0;
  while (i < n - 1) {
    if (a[i] == a[i + 1] && a[i] > 0) {
      if (a[i + 1] > 0) {
        a[i + 1] = a[i] - 1;
      }
      sort(a, a + n);
      i = 0;
    } else {
      i++;
    }
  }
  i = 0;
  while (i != n) {
    cnt = cnt + a[i];
    i++;
  }
  cout << cnt;
}
