from heapq import heappop, heappush import sys input = sys.stdin.readline n = int(input()) A = list(map(int, input().split())) cnt = 0 while len(A) > 1: a = heappop(A) b = heappop(A) if cnt % 2 == 0: temp = a * b heappush(A, -1 * temp) else: a *= -1 temp = (b + a - 1) // a heappush(A, temp) cnt += 1 print(abs(A[0]))