from heapq import heappop, heappush

N = int(input())
A = [int(i) for i in input().split()]

info = [[] for _ in range(N)]
for i,a in enumerate(A):
    for j in range(N):
        heappush(info[j], ((-1) * a * abs(i - j), i))