## https://yukicoder.me/problems/no/1816 import heapq def main(): N = int(input()) A = list(map(int, input().split())) A.sort() index = [False] * (2 * N) min_queue = [] max_queue = [] for i in range(N): heapq.heappush(min_queue, (A[i], i)) for i in range(N): heapq.heappush(max_queue, (-A[i], i)) for turn in range(N - 1): if turn % 2 == 0: array = [] while len(array) < 2: min_value, min_index = heapq.heappop(min_queue) if not index[min_index]: array.append(min_value) index[min_index] = True x = array[0] * array[1] heapq.heappush(min_queue, (x, N + turn)) heapq.heappush(max_queue, (-x, N + turn)) else: array_count = 0 while array_count < 2: _, max_index = heapq.heappop(max_queue) if not index[max_index]: array_count += 1 index[max_index] = True heapq.heappush(min_queue, (1, N + turn)) heapq.heappush(max_queue, (-1, N + turn)) while len(min_queue) > 0: min_value, min_index = heapq.heappop(min_queue) if not index[min_index]: print(min_value) break if __name__ == "__main__": main()