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

vector<int> boxesWide;
vector<int> boxesLeft;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int numberBoxes;
    long long boxesWideTotal=0;
    cin >> numberBoxes;

    for(int currentBox=1; currentBox<=numberBoxes; currentBox++)
    {
        int currentBoxWide;
        cin >> currentBoxWide;

        boxesWide.push_back(currentBoxWide);
        boxesLeft.push_back(currentBoxWide-1);
        boxesWideTotal+=currentBoxWide;
    }

    sort(boxesWide.begin(), boxesWide.end());
    sort(boxesLeft.begin(), boxesLeft.end());

    for(int currentBox=0; currentBox<boxesWide.size(); currentBox++)
    {
        for(int otherBox=currentBox+1; otherBox<boxesWide.size(); otherBox++)
        {
            if(boxesWide[currentBox]<=boxesLeft[otherBox])
            {
                boxesWideTotal-=boxesWide[currentBox];
                boxesLeft[otherBox]-=boxesWide[currentBox];
                break;
            }
        }
    }

    cout << boxesWideTotal;
    return 0;
}

