#include <bits/stdc++.h>
using namespace std;

void deliting(int num, vector<int> &a){
    for(int i = 0; i < a.size(); i++){
        if (a[i] < a[num] && a[i] != 1)
            a[i]--;
        if (a[i] > a[num])
            a[i]++;
    }
    a[num] = 1;
}

int main() {
    int n;
	cin >> n;
    vector <int> a;
    int g, cnt = 0;
    for (int i = 0; i < n; i++){
        cin >> g;
        a.push_back(g);
    }
    sort(a.begin(), a.end());
    while (a[a.size() - 1] != 1){
        cnt += a[a.size() - 1];
        deliting(a.size() - 1, a);
        sort(a.begin(), a.end());
    }
    cout << cnt;
}