import heapq N = int(input()) A = list(map(int,input().split())) q = [] for i in A: heapq.heappush(q,-i) for i in range(N-1): v = -1 * heapq.heappop(q) w = -1 * heapq.heappop(q) if i % 2 == 0: heapq.heappush(q, -1 * v*w) else: heapq.heappush(q,-1) print (-1 * q[0])