#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int INF = 0x3f3f3f3f;
const int M = 40000 + 5;
int main() {
  long long n, i, S, j, m, k;
  long long mark[30], s[30];
  while (~scanf("%lld", &n)) {
    memset(mark, 0, sizeof(mark));
    memset(s, 0, sizeof(s));
    for (i = 1; i <= n; i++) scanf("%lld", &s[i]);
    S = 0;
    for (i = 1; i <= n; i++) {
      for (j = i + 1; j <= n; j++)
        if (s[j] == s[i]) {
          s[j]--;
          for (k = j - 1; k >= 1; k--)
            if (s[k] == s[j] && s[k] > 0) s[j]--;
        } else {
          for (k = j - 1; k >= 1; k--)
            if (s[k] == s[j] && s[k] > 0) s[j]--;
        }
    }
    for (i = 1; i <= n; i++)
      for (j = i + 1; j <= n; j++)
        if (s[i] == s[j]) printf("***************%d    %d\n", i, j);
    for (i = 1; i <= n; i++)
      if (s[i] > 0) S += s[i];
    printf("%lld\n", S);
  }
  return 0;
}
