from heapq import * class QuasiBinaryTree: def __init__(self, rule="min"): if rule == "max": self.pm = -1 else: self.pm = 1 self.inf = 10**18 self.P = [self.inf] self.Q = [] def insert(self, x): heappush(self.P, x * self.pm) def erase(self, x): heappush(self.Q, x * self.pm) def top(self): while self.Q and (self.P[0] == self.Q[0]): heappop(self.P) heappop(self.Q) return self.P[0] * self.pm N = int(input()) A = list(map(int, input().split())) T1 = QuasiBinaryTree("min") T2 = QuasiBinaryTree("max") for a in A: T1.insert(a) T2.insert(a) if N == 1: print(A[0]) exit() elif N == 2: print(A[0] * A[1]) exit() elif N % 2: print(1) exit() for i in range(N - 1): if i % 2 == 0: a = T1.top() T1.erase(a) b = T1.top() T1.erase(b) T1.insert(a * b) T2.erase(a) T2.erase(b) T2.insert(a * b) else: a = T2.top() T2.erase(a) b = T2.top() T2.erase(b) T2.insert(1) T1.erase(a) T1.erase(b) T1.insert(1) print(T1.top())