#include <bits/stdc++.h>
int main() {
  long long int letters[26], n, i, j, sum = 0, value, index;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) scanf("%lld", &letters[i]);
  for (i = 1; i < n; i++) {
    int value = letters[i];
    int index = i;
    for (j = i - 1; j >= 0; j--) {
      if (letters[j] < value) letters[index] = letters[j], index--;
      if (letters[j] > value || j == 0) letters[index] = value;
    }
  }
  sum = letters[0];
  for (i = 1; i < n; i++) {
    if (letters[i] == letters[i - 1]) {
      value = letters[i - 1];
      index = j;
      for (j = i; j < n; j++) {
        if (letters[j] == value && letters[j] > 0)
          letters[j] = letters[j] - 1;
        else
          break;
      }
      sum = sum + letters[i];
    } else
      sum = sum + letters[i];
  }
  printf("%lld\n", sum);
  return 0;
}
