#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, s, a[30];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  s = m = a[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    m--;
    if (m == 0) break;
    m = min(a[i], m);
    s += m;
  }
  cout << s << endl;
  return 0;
}
