#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n;
  cin >> n;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  while (1) {
    long long int count = 0;
    for (long long int i = 0; i < n - 1; i++) {
      if (arr[i] == arr[i + 1] && arr[i] != 0) {
        arr[i]--;
        count++;
      }
    }
    if (count == 0) break;
  }
  cout << accumulate(arr, arr + n, 0ll);
}
