#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long

using namespace std;
ll a[100007],n,q,k,m,z;
int main(){
   //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for(int i = 1;i <= n;i++){
    	cin >> a[i];
	}
	sort(a + 1, a + n + 1);
	m = 0;
	q = 0;
	for(int i = n;i > 0;i--){
		if(a[i] > 0){
			if(a[i] != m){m = a[i]; z = a[i] - q; }
			 if(z > 0){k += z; q++; }
		}
	}
	cout << k;
  return 0;
}

/*
5
3 4 4 5 5






*/