import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

int INF = int.max / 8;
long LINF = long.max / 8;

int N;
long[] A;

void input() {
    scanf("%d\n", &N);
    A = new long[N];
    foreach (i; 0 .. N) {
        scanf("%ld\n", &A[i]);
    }
}

void solve() {
    auto S = new long[N + 1];
    S[0] = 0;
    foreach (i; 1 .. N + 1) {
        S[i] = S[i - 1] + A[i - 1];
    }

    auto memo = new int[long][N];
    auto next = new int[N]; next[] = -1;
    int dfs(int index, long M) {
        if (index == N) { return 1; }
        auto R = S[N] - S[index];
        if (M in memo[index]) return memo[index][M];
        int ret = -INF;
        long minM1 = LINF;
        foreach (int i; index + 1 .. N + 1) {
            auto M1 = S[i] - S[index];
            if (M1 >= minM1) continue;
            if (M1 > M) {
                auto n = dfs(i, M1) + 1;
                if (n < 0) continue;
                if (ret < n) {
                    ret = n;
                    minM1 = M1;
                    next[index] = i;
                }
            }
        }
        return memo[index][M] = ret;
    }
    auto len = dfs(0, -LINF) - 1;
    if (len < 0) {
        writeln(1);
        writeln;
    } else {
        writeln(len);
        int[] ans;
        for (int i = 0; next[i] < N; i = next[i] ) {
            ans ~= next[i];
        }
        writefln("%(%s %)", ans);
    }
    //writeln(S);
}

void main() {
    input; solve;
}