N=int(input()) A=[int(x) for x in input().split()] if max(A)==1: print(1) elif N==1: print(A[0]) elif N==2: print(A[0]*A[1]) else: print(0)