n = int(input()) a = list(map(int,input().split())) if n % 2 == 1: if n == 1: print(a[0]) else: print(1) else: a.sort(reverse=True) m1 = a.pop() m2 = a.pop() a.append(m1*m2) a.sort() print(a[0])