
N = int(input())

Rope = [0 for _ in range(N)]
for i in range(N): Rope[i] = int(input())

Rope.sort(reverse = True)

Answer = [0 for _ in range(N)]
for i in range(N): Answer[i] = (i+1) * Rope[i]

print(max(Answer))
