import heapq N = int(input()) A = list(map(int, input().split())) A.sort() if N == 1: print(A[0]) elif N == 2: print(A[0] * A[1]) elif N % 2 == 1: # 後手で終わり print(1) else: # 先手で終わり heap = A[:] heapq.heapify(heap) cnt = 1 while cnt != N // 2: a = heapq.heappop(heap) b = heapq.heappop(heap) c = a * b heapq.heappush(heap, c) cnt += 1 print(heap[0])