#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define Pr(a) (#a)<<"="<<(a)<<" "
#define pr1(a) cerr<<Pr(a)<<endl;
#define pr2(a,b) cerr<<Pr(a)<<Pr(b)<<endl;
#define pr3(a,b,c) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<endl;
#define pr4(a,b,c,d) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<endl;
#define pr5(a,b,c,d,e) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<endl;
#define pr6(a,b,c,d,e,f) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<Pr(f)<<endl;
//#define int long long
#define double long double
using namespace std;
const int INF = 1e9;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef long long ll;
typedef pair<ll,ll> P;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

class CumulativeSum{
public:
  typedef long long ll;
  vector<ll> sum;
  CumulativeSum(){}
  CumulativeSum(vector<ll> A){
    ll n = A.size();
    sum.resize(n+1,0);
    for(ll i=1;i<=n;i++) sum[i] += sum[i-1] + A[i-1];
  }
  ll get(ll l,ll r){assert(l>=0 && r<=(ll)sum.size());return sum[r] - sum[l];} //[l,r)
};

const int N = 4001;
signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin>>n;
  vector<ll> A(n);
  cin>>A;
 
  CumulativeSum Sum(A);
  

  vector<int> ord(n+1); iota(ord.begin(), ord.end(), 0);
  sort(ord.begin(), ord.end(), [&](int a,int b){
      ll sa = Sum.get(0, a);
      ll sb = Sum.get(0, b);
      return sa > sb;
    });
  
  auto rord = ord; reverse(rord.begin(), rord.end());

  vector<vector<int> > dp(N, vector<int>(N, -INF));   
  vector<vector<int> > pre(N, vector<int>(N, -INF));   
  for(int i=1;i<=n;i++) dp[i][0] = 1;
  
  for(int l=0;l<n;l++) {
    vector<P> d; //dp[l][i]は段々増加していく、合計値は減少していく
    for(int i:ord) if(i < l) d.push_back(P(dp[l][i], i ));
    for(int i=0;i<(int)d.size()-1;i++) if(d[i] > d[i+1]) d[i+1] = d[i];
    int idx = 0;
    if(d.empty()) continue;
    for(int r:rord) { //rが進むにつれaが小さくなる
      if(l >= r) continue;
      
      ll a = 2 * Sum.get(0, l) - Sum.get(0, r);
      while(idx+1 < (int)d.size() && a < Sum.get(0, d[idx+1].second)) idx++;
      
      int x, k; tie(x, k) = d[idx];
      if(a >= Sum.get(0, k)) continue;
      
      /*
        for(int k=0;k<l;k++){
        int b = Sum.get(0, k);
        if(a < b && x < dp[l][k]) x = dp[l][k], idx = k;
      } 
      */
      
      Max(dp[r][l], x + 1);
      pre[r][l] = k;
    }
  }  
  
  int num = -INF;
  int l = -1, r = n;
  for(int i=0;i<n;i++) if(num < dp[r][i]) num = dp[r][i], l = i;
  
  vector<int> ans;
  ans.push_back(l);
  for(int i=0;i<num-1;i++) {
    int p = pre[r][l];
    r = l;
    l = p;
    ans.push_back(p);
  }
  ans.pop_back();
  reverse(ans.begin(), ans.end());
  cout<<num<<endl;
  cout<<ans<<endl;

  return 0;
}



Measured memory_bytes: 128564