링크 : https://www.acmicpc.net/problem/2217
/*
문제 : 로프
링크 : https://www.acmicpc.net/problem/2217
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> v;
for(int i = 0; i < n; i++){
int tmp;
cin >> tmp;
v.push_back(tmp);
}
sort(v.begin(), v.end());
int result = 0;
for(int i = 0; i < n; i++){
int sum = v[i] * (n - i);
if (sum > result) result = sum;
}
cout << result;
return 0;
}