#include<iostream>
using namespace std;
int main(){
    unsigned long long n, otg = 0;
    cin >> n;
    unsigned long long boxes[n][2];
    for(long long i = 0; i < n; i++){
        cin >> boxes[i][0];
        boxes[i][1] = boxes[i][0] - 1;
    }
//    for(long long j = 0; j < n; j++){
//        cout << boxes[j][0] << " " << boxes[j][1] << ", ";
//    }
    cout << endl;
    for(long long i = 0; i < n; i++){
        long long closestTo, closestToIndex;
        closestTo = 0;
        for(long long j = 0; j < n; j++){
            if(j != i){
                if(boxes[j][0] > closestTo && boxes[j][0] < boxes[i][0]){
                    closestTo = boxes[j][0];
                    closestToIndex = j;
                }
            }
        }
        boxes[i][1] = boxes[closestToIndex][1];
        boxes[closestToIndex][0] = 0;
        boxes[closestToIndex][1] = 0;
//        for(long long j = 0; j < n; j++){
//            cout << boxes[j][0] << " " << boxes[j][1] << ", ";
//        }
//        cout << endl;
    }
    for(long long i = 0; i < n; i++){
        otg += boxes[i][0];
    }
    cout << otg;
    return 0;
}
