#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define ff first
#define ss second
#define pb push_back

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

    int n;
    cin >> n;
    vector<ll> v(n+1), pref(n+1);
    for (int i=1; i<=n; i++)
        cin >> v[i];
    pref[0] = 0;
    for (int i=1; i<=n; i++) {
        pref[i] = pref[i-1] + v[i];
    }
    if (pref[n] %3 == 0) {
        cout << 0 << "\n";
    }else
        cout << 1 << "\n";
    cout << 1 << " ";
    ll x = pref[n]/3, s=0, t=0;
    //cout << x << "?\n";
    for (int i=1; i<=n; i++) {
        s += v[i];
        if (s == x) {
            s = 0;
            t++;
            cout << i+1+(t == 2 && pref[n]%3 == 2) << " ";
        }
        if (t == 2)
            break;
    }
}