728x90
package Greedy;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Rope {
public static void main(String[] args) throws IOException {
int n;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
n = Integer.parseInt(br.readLine());
int[] ropes = new int[n];
for(int i=0; i<n; i++){
ropes[i]=Integer.parseInt(br.readLine());
}
Arrays.sort(ropes);
for(int i=0; i<n; i++){
ropes[i] = ropes[i] * (n-i);
}
Arrays.sort(ropes);
System.out.println(ropes[ropes.length-1]);
}
}