N = int(input()) A = list(map(int, input().split())) take = [0] * (N + 1) stay = [0] * (N + 1) for i, a in enumerate(A, 1): # とるとき take[i] = stay[i - 1] + a # とらない stay[i] = max(stay[i-1], take[i-1]) ans = max(take[N], stay[N]) pos = [] i = N while i > 0: if ans == take[i]: pos.append(i) ans -= A[i - 1] i -= 1 i -= 1 print(*pos[::-1])