x = list(map(int, input().split())) x = x[slice(1, x[0]+1)] print(min(x) * max(x))