a = int(input()) b = [] for i in range(a): c = int(input()) b.append(c) m1 = min(b) m2 = max(b) wyn = m1 * m2 print(wyn)