N = int(input()) A = list(map(int,input().split())) A.sort() import sys import heapq """ if N == 1: print(A[0]) exit() if N % 2 == 1: print(1) exit() heapq.heapify(A) for _ in range(N//2): a = heapq.heappop(A) b = heapq.heappop(A) heapq.heappush(A,a * b) print(heapq.heappop(A)) """ if N == 1: print(A[0]) elif N == 2: print(A[0] * A[1]) elif N % 2 == 1: print(1) else: print(min(A[0]*A[1],A[2]))