N =int(input()) A = list(map(int,input().split())) A.sort() if N==1: out = A[0] elif N==2: out = A[0] * A[1] else: if N%2 == 0: out = max(A[2], A[0]*A[1]) else: out = 1 print(out)