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