#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
using namespace std;

typedef long long LL;

int main(){
	const short SLIM = 20000;
	const LL LLIM = 1LL << 60;

	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	vector<LL> psum(n + 1);
	for(int i = 1; i <= n; ++i){
		LL a;
		cin >> a;
		psum[i] = psum[i - 1] + a;
	}

	vector<vector<pair<LL,short>>> vals(n + 1);
	vector<vector<tuple<short,short,short>>> dp(n + 1);
	for(int i = 0; i <= n; ++i){
		auto &v = vals[i];
		v.reserve(n - i + 1);
		v.emplace_back(LLIM, -1);
		for(int j = i + 1; j <= n; ++j){
			v.emplace_back(psum[j] - psum[i], j);
		}
		sort(v.begin(), v.end());
		dp[i].assign(v.size(), make_tuple(-SLIM, -1, -1));
	}
	dp[0][0] = make_tuple(0, -1, -1);
	for(int i = 0; i <= n; ++i){
		int sz = vals[i].size();
		for(int j = 0; j < sz; ++j){
			if(j > 0){ dp[i][j] = max(dp[i][j], dp[i][j - 1]); }
			if(get<0>(dp[i][j]) < 0){ continue; }
			int k = vals[i][j].second;
			if(k >= 0){
				int l = upper_bound(vals[k].begin(), vals[k].end(), make_pair(vals[i][j].first, SLIM)) - vals[k].begin();
				tuple<short,short,short> tp(get<0>(dp[i][j]) + 1, i, j);
				dp[k][l] = max(dp[k][l], tp);
			}
		}
	}
	
	vector<int> ans;
	int pos = n, h = dp[n].size() - 1;
	while(true){
		auto t = dp[pos][h];
		pos = get<1>(t);
		h = get<2>(t);
		if(pos <= 0){ break; }
		ans.push_back(pos);
	}
	reverse(ans.begin(), ans.end());
	cout << (ans.size() + 1) << '\n';
	bool fst = true;
	for(int x : ans){
		if(!fst){ cout << ' '; }
		cout << x;
		fst = false;
	}
	cout << '\n';
}

