#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
int N;
long long X[4001];
int dp[4001][4001], pre[4001][4001];

inline long long key(int i, int j) { return X[j] - X[i]; }
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  rep(i, N) cin >> X[i+1];
  for (int i=0; i<N; i++) X[i+1] += X[i];

  rep(i, N+1) rep(j, N+1) dp[i][j] = -INF, pre[i][j] = -1;
  for (int i=1; i<=N; i++) dp[0][i] = 1, pre[0][i] = 0;
  rep(i, N+1) {
    vector<pair<long long, P> > left, right;
    for (int j=0; j<i; j++)    left.pb(make_pair(key(j, i), P(dp[j][i], j)));
    for (int j=i+1; j<=N; j++) right.pb(make_pair(key(i, j), P(dp[i][j], j)));
    sort(all(left));
    sort(all(right));
    int head = 0;
    P m = P(-INF, -1);
    for (auto p : right) {
      while (head < left.size() && left[head]._1 < p._1) m = max(m, left[head++]._2);
      if (m._1 != -INF) {
        int j = p._2._2;
        assert(dp[i][j] < m._1+1);
        dp[i][j] = m._1+1, pre[i][j] = m._2;
      }
    }
  }

  P m = P(-INF, -1);
  rep(i, N+1) m = max(m, P(dp[i][N], i));
  int m2 = m._2, m1 = m._1;
  vector<int> ans;
  int left = m2, right = N;
  while (left != 0) {
    ans.pb(left);
    int k = left;
    left = pre[left][right];
    right = k;
  }
  reverse(all(ans));
  assert(ans.size() == m1-1);
  cout << m1 << "\n";
  for (int x : ans) cout <<x << " "; cout << "\n";
  return 0;
}