#include <bits/stdc++.h>
#include <random>

using namespace std;

#define ll long long
#define endl '\n'
#define ld long double
#define pb push_back

const ll clasik = 7e5+7;
const ll INF = 1e17;
const ll mod = 1e9+7;
const ll mln = 1e6+111;

ll df[clasik];

void solve() {

    ll n;

    cin>>n;

    ll sum = 0;

    for (int i = 1 ; i<=n ; i++) {
        cin>>df[i];
        sum+=df[i];
    }

    ll p1 , p2 , p3;

    cout<<(sum%3 ? 1 : 0)<<endl;

    p1 = 1;

    ll curr = 0;

    for (int i = 1 ; i<=n ; i++) {
        curr+=df[i];
        if (curr>=(sum/3 )) {
            p2 = i+1;
            curr = 0;
            for (int j = i+1 ; j<=n ; j++) {
                curr+=df[j];
                if (curr>=sum/3 + (sum%3 ==2 ? 1 : 0)) {
                    cout<<p1<<" "<<p2<<" "<<j+1<<endl;
                    return;
                }
            }
        }
    }

}

signed main() {
    
    int t = 1;

    //cin>>t;

    while(t--) solve();

    return 0;
}