#include #include #include using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin>>n; vector a(n); for(int i = 0;i>a[i]; sort(a.begin(),a.end()); reverse(a.begin(),a.end()); ll ans = 0; for(int i = 0;i