#include <bits/stdc++.h>
using namespace std;
int min(int x, int y) { return (x < y) ? x : y; }
int max(int x, int y) { return (x > y) ? x : y; }
int main() {
  int n, x;
  scanf("%d", &n);
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    while (m[x] != 0 && x > 0) {
      x--;
    }
    if (x != 0) m[x]++;
  }
  long long xx = 0;
  for (map<int, int>::iterator it = m.begin(); it != m.end(); it++) {
    xx += it->first;
  }
  printf("%I64d\n", xx);
  return 0;
}
