from collections import deque 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: a = deque(a) now = 1 for i in range(n - 1): if i % 2 == 0: now = a.popleft() * a.popleft() else: now1 = a.pop() now2 = a.pop() if now2 < now: a.append(now2) a.appendleft(1) else: a.append(now) now = now2 a.appendleft(1) print(now)