import heapq def main(): import sys input = sys.stdin.read().split() N = int(input[0]) A = list(map(int, input[1:N+1])) if N == 1: print(A[0]) return max_heap = [-x for x in A] heapq.heapify(max_heap) min_heap = A.copy() heapq.heapify(min_heap) total_ops = N - 1 alice_ops = (total_ops + 1) // 2 bob_ops = total_ops // 2 current_ops = 0 is_alice_turn = True while current_ops < total_ops: if is_alice_turn: x = -heapq.heappop(max_heap) y = -heapq.heappop(max_heap) product = x * y heapq.heappush(max_heap, -product) heapq.heappush(min_heap, product) else: x = heapq.heappop(min_heap) y = -heapq.heappop(max_heap) z = (x + y - 1) // y # Equivalent to ceiling(x/y) heapq.heappush(max_heap, -z) heapq.heappush(min_heap, z) is_alice_turn = not is_alice_turn current_ops += 1 print(-max_heap[0]) if __name__ == "__main__": main()