#include <bits/stdc++.h>
using namespace std;
int mas[3000000];
int psum[3000000];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    int sum=0;
    for (int i=0;i<n;i++) {
        cin>>mas[i];
        sum+=mas[i];
    }
    int s=0;int i=0;
    while (s<sum/3) {
        s+=mas[i];
        i++;
    }
    int j=i;
    s=0;
    while (s<sum/3) {
        s+=mas[j];
        j++;
    }
    if (sum%3==0)cout<<0;
    else cout<<1;
    cout<<'\n'<<1<<' '<<i+1<<' '<<j+1;
}
