#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];
    }

    if (sum == 0) {
        cout<<0<<endl;
        cout<<1<<" "<<2<<" "<<3<<endl;
        return;
    }

    if (sum == 1) {
        cout<<1<<endl;
        ll pos = 0;
        for (int i =1 ; i<=n ; i++) {
            if (df[i] == 1) {
                pos = i;
                break;
            }
        }
        if (pos == 1) {
            cout<<1<<" "<<2<<" "<<3<<endl;
            return;
        }
        if (pos == n) {
            cout<<1<<" "<<2<<" "<<3<<endl;
            return;
        }
        cout<<1<<" "<<pos<<" "<<pos+1<<endl;
        return;
    }
    if (sum == 2) {
        cout<<1<<endl;
        ll pos1 = 0, pos2 = 0;
        for (int i = 1 ; i<=n ; i++) {
            if (df[i] == 1) {
                if (pos1 == 0) pos1 = i;
                else {
                    pos2 = i;
                    break;
                }
            }
        }
        if (pos1 == 1) {
            cout<<1<<" "<<2<<" ";
            cout<<pos2 + (pos2 == 2 ? 1 : 0)<<endl;
            return;
        }
        else {
            cout<<1<<" "<<pos1<<" "<<pos2<<endl;
            return;
        }
    }

    if (sum%3 == 0) {
        ll need = sum/3;
        ll curr = 0;
        cout<<0<<endl;
        cout<<1<<" ";
        ll cnt = 1;
        for (int i = 1 ; i<=n ; i++) {
            curr+=df[i];
            if (curr == need) {
                curr = 0;
                cnt++;
                cout<<i+1<<" ";
            }
            if (cnt == 3) break;
        }
        cout<<endl;
        return;
    }
    if (sum%3 == 1) {
        ll need = sum/3;
        ll curr = 0;
        cout<<0<<endl;
        cout<<1<<" ";
        ll cnt = 1;
        for (int i = 1 ; i<=n ; i++) {
            curr+=df[i];
            if (curr == need) {
                curr = 0;
                cnt++;
                cout<<i+1<<" ";
            }
            if (cnt == 3) break;
        }
        cout<<endl;
        return;
    }
    if (sum%3 == 2) {
        ll need = sum/3;
        need++;
        ll curr = 0;
        cout<<0<<endl;
        cout<<1<<" ";
        ll cnt = 1;
        for (int i = 1 ; i<=n ; i++) {
            curr+=df[i];
            if (curr == need) {
                curr = 0;
                cnt++;
                cout<<i+1<<" ";
            }
            if (cnt == 3) break;
        }
        cout<<endl;
        return;
    }

}

signed main() {
    
    int t = 1;

    //cin>>t;

    while(t--) solve();

    return 0;
}