import java.io.BufferedInputStream; import java.util.*; public class Main { public static void main(String[] argv){ Scanner sc = new Scanner(new BufferedInputStream(System.in)); TreeMap s = new TreeMap(); int n = sc.nextInt(); long[] a= new long[n]; for(int i = 0 ; i < n ; i++){ a[i] = sc.nextLong(); s.put(a[i], s.getOrDefault(a[i], 0) + 1); } if ( n>1 && n % 2 == 1) { System.out.println(1); } else { int t = 0; int tot = n; while(tot>1){ if (t % 2 ==0) { Map.Entry x = s.pollFirstEntry(); long key1 = x.getKey(); int val1 = x.getValue() - 1; tot--; if (val1 == 0 ) s.remove(key1); else s.put(key1, val1); Map.Entry y = s.pollFirstEntry(); long key2 = y.getKey(); int val2 = y.getValue() - 1; tot--; if(val2==0) s.remove(key2); else s.put(key2, val2); tot++; s.put(key1*key2, s.getOrDefault(key1*key2, 0 )+ 1); }else{ Map.Entry x = s.pollLastEntry(); long key1 = x.getKey(); int val1 = x.getValue() - 1; tot--; if (val1 == 0) s.remove(key1); else s.put(key1, val1); Map.Entry y = s.pollLastEntry(); long key2 = y.getKey(); int val2 = y.getValue() - 1; tot--; if(val2 == 0) s.remove(key2); else s.put(key2, val2); tot++; s.put(1L, s.getOrDefault(1L, 0 )+ 1); } t^=1; } System.out.println(s.firstKey()); } } }