#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int main() {
  int n;
  scanf("%d", &n);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    while (1) {
      if (mp[a] == 0 || a == 0) {
        mp[a] = 1;
        sum += (long long)a;
        break;
      } else
        a--;
    }
  }
  printf("%I64d\n", sum);
  return 0;
}
