import java.util.*; import java.io.*; public class Main { public static Scanner sc = new Scanner(System.in); public static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) { int T = 1; while( T > 0 ) { solve(); T--; } pw.flush(); } static void solve() { int N = sc.nextInt(); PriorityQueue pqueue = new PriorityQueue<>(Collections.reverseOrder()); for( int i = 0; i < N; i++ ) { long a = sc.nextInt(); pqueue.offer(a); } for( int i = 0; i < N-1; i++ ) { long p = pqueue.poll(); long q = pqueue.poll(); if( i%2 == 0 ) pqueue.offer(p*q); else pqueue.offer((p+q-1)/q); } pw.println(pqueue.poll()); } }