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

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

    int n;
    cin >> n;
    vector <int> v(n);
    long sum = 0;
    for (int j = 0; j < n; j++) { cin >> v[j]; sum += v[j]; }
    if (n == 3) {
    cout << max(v[0], max(v[1], v[2])) - min(v[0], min(v[1], v[2])) << endl;
    cout << "1 2 3" << endl;
    return 0;
    }
    int s = sum/3;
    int i = 0;
    int cur = v[i];
    while (cur < s && i < n - 1) {
        i++;
        cur += v[i];
    }
    int y = i+2;

    if (sum%3==2)
    s++;
    i = y;
    cur = v[i];
    while (cur < s && i <= n - 1) {
        i++;
        cur += v[i];
    }
    int z = i+2;
    cout << (sum%3+1)/2 << endl;
    cout << 1 << " " << y << " " << z << endl;
}
