import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//在此输入您的代码
int n = scan.nextInt();
int[] arr = new int[n];
for(int i = 0;i < n;i++){
arr[i] = scan.nextInt();
}
Arrays.sort(arr); //升序
//两种情况 1、正常升序后数组后面三个数据
//2、需要考虑负负得正的情况
int m1 = arr[n-1] * arr[n-2] * arr[n-3];
int m2 = arr[0] * arr[1] * arr[n-1];
if(m1 > m2){
System.out.println(m1);
}else{
System.out.println(m2);
}
scan.close();
}
}
12-07
215
02-13
875
11-06
900