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

int n,s = 0, s1 = 0, s2 = 0, s3 = 0;
int arr[1000005];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    
    cin>>n;
    for (int i = 0; i < n; i++){
        cin >> arr[i];
        s += arr[i];
    }
    if (s%3 == 0) cout << 0;
    else cout << "1";
    cout << endl;


    cout << "1 ";
    if (s%3 >= 1) s1 = -1;
    if (s%3 == 2) s2 = -1;
    if (s < 2){
        cout << "2 3";
        return 0;
    }
    int k = 0;
    while (s1 != s/3){
        s1 += arr[k];
        k++;
    }
    cout << k+1 << ' ';
    while (s2 != s/3){
        s2 += arr[k];
        k++;
    }
    cout << k+1;
}
