링크 : https://www.acmicpc.net/problem/14487
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
int main(){
int N = 0;
cin >> N;
vector <int> v;
for(int i = 0; i < N; i++){
int temp;
cin >> temp;
v.push_back(temp);
}
sort(v.begin(), v.end(), greater<int>());
int sum = 0;
for(int i : v){
sum += i;
}
sum -= v[0];
cout << sum;
return 0;
}