#include <bits/stdc++.h>
using namespace std;
map<int, int> M;
long long sum;
int N, read;
int main(void) {
  scanf("%d", &N);
  sum = 0;
  for (int i = 0; i < N; i++) {
    scanf("%d", &read);
    while (read > 0 && M[read] > 0) read--;
    M[read]++;
    sum = sum + 1LL * read;
  }
  printf("%I64d", sum);
  return 0;
}
