N=int(input()) A=list(map(int,input().split())) for i in range(N): A[i]*=-1 from heapq import * heapify(A) C=0 while N>1: x=-heappop(A) y=-heappop(A) if C&1: heappush(A,-((x+y-1)//y)) else: heappush(A,-(x*y)) N-=1 C+=1 print(-heappop(A))