import heapq n = int(input()) A = list(map(int, input().split())) A = [-a for a in A] heapq.heapify(A) b = 1 while len(A) > 1: a1 = heapq.heappop(A) a2 = heapq.heappop(A) if b: heapq.heappush(A, -a1 * a2) else: heapq.heappush(A, -((a2 - 1) // a1 + 1)) b = not b print(-A[0])