#include <bits/stdc++.h>
using namespace std;
#define lol long long
#define forin for(int i = 1; i <= n; i++)
#define forjn for(int j = 1; j <= n; j++)
#define forch(j, k) for(int i = j; i <= k; i++)
#define Yes cout << "YES" << endl
#define No cout << "NO" << endl
const lol N = 3e5+10;
lol t, n, a[N], c, x, y, z, sm;
void solve() {
    cin >> n;
    forin cin >> a[i], c += a[i];
    if(c % 3 == 0) {
        while(sm < c/3) { x++; if(a[x] == 1) sm++; }
        y = x;
        sm = 0;
        while(sm < c/3) { y++; if(a[y] == 1) sm++; }
        z = y+1;
        cout << 0 << endl;
        cout << 1 << " " << x+1 << " " << z << endl;
    }
    else {
        if(c % 2) {
            while(sm < c/2) { x++; if(a[x] == 1) sm++; }
            y = x;
            sm = 0;
            while(sm < c/2) { y++; if(a[y] == 1) sm++; }
            z = y+1;
            cout << 1 << endl;
            cout << 1 << " " << x+1 << " " << z << endl;
        }
        else {
            c -= 2;
            while(sm < c/2) { x++; if(a[x] == 1) sm++; }
            y = x;
            sm = 0;
            while(sm < c/2) { y++; if(a[y] == 1) sm++; }
            z = y+1;
            cout << 1 << endl;
            cout << 1 << " " << x+1 << " " << z << endl;
        }
    }
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    t = 1;
    //cin >> t;
    while(t--) solve();
}