#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  int n;
  cin>>n;
  vector<int> as(n);
  for(int i=0;i<n;i++) cin>>as[i];

  vector<ll> sm(n+1,0);
  for(int i=0;i<n;i++) sm[i+1]=sm[i]+as[i];

  const ll MUL = 1e4;
  const ll OFS = 1e14;
  auto P1=[&](ll x,int y){return (x+OFS)*MUL+y;};
  vector< vector<ll> > G(n);
  for(int l=0;l<n;l++){
    for(int r=l+1;r<=n;r++)
      G[l].emplace_back(P1(sm[r]-sm[l],r));
    sort(G[l].begin(),G[l].end());
  }

  using P2 = pair<short, short>;
  vector< vector<P2> > dp(n+1,vector<P2>(n+1,P2(-n,0)));
  for(int l=0;l<n;l++){
    for(auto pp:G[l]){
      int r=pp%MUL;
      if(l==0) chmax(dp[l][r],P2(1,-1));

      int x=lower_bound(G[l].begin(),G[l].end(),P1(sm[r]-sm[l],r))-G[l].begin();
      if(x+1<(int)G[l].size())
        chmax(dp[l][G[l][x+1]%MUL],dp[l][r]);

      if(r==n) continue;
      int k=upper_bound(G[r].begin(),G[r].end(),P1(sm[r]-sm[l],n))-G[r].begin();
      if(k<(int)G[r].size())
        chmax(dp[r][G[r][k]%MUL],P2(dp[l][r].first+1,l));
    }
  }

  P2 ans(0,-1);
  for(int l=0;l<n;l++)
    chmax(ans,dp[l][n]);

  int l=-1,r=n;
  for(int i=0;i<n;i++)
    if(ans==dp[i][n]) l=i;

  cout<<ans.first<<endl;
  vector<int> res;
  while(l!=0){
    res.emplace_back(l);
    int nl=dp[l][r].second;
    int nr=l;
    l=nl;r=nr;
  }
  reverse(res.begin(),res.end());
  for(int i=0;i<(int)res.size();i++){
    if(i) cout<<" ";
    cout<<res[i];
  }
  cout<<endl;
  return 0;
}

