#include <bits/stdc++.h>
using namespace std;
const int N = 30;
long long n, a[N], ans, limit = 1e9 + 10;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = 0; i < n; i++) {
    ans += min(a[i], limit);
    limit = min(limit - 1, a[i] - 1);
    if (limit <= 0) break;
  }
  cout << ans;
  return 0;
}
