#include <bits/stdc++.h>
#define ll long long
using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> v(n);
    int s = 0;
    for(int i=0; i<n; i++) {
        cin >> v[i];
        if(v[i]==1) s++;
    }
    int g = s/3;
    if(s%3==0) {
        cout << 0 << endl;
    } else cout << 1 << endl;
    int k = 0, gr = 0;
    for(int i=0; i<n; i++) {
        k+=v[i];
        if(k>=g && gr<3) {
                gr++;
                cout << i << " ";
                k = 0;
        }
    }
}

int main() {
    int test = 1;
    while(test--) {
        solve();
    }
}
