import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Task2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int[] a = new int[n];
            for(int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }
            if(n == 3) {
                int max = -1;
                int min = Integer.MAX_VALUE;
                for(int i = 0; i < 3; i++) {
                    if(a[i] > max) {
                        max = a[i];
                    }
                    if(a[i] < min) {
                        min = a[i];
                    }
                }
                System.out.println(max - min);
                System.out.println("1 2 3");
                return;
            }
            int sum = 0;
            boolean isBreak = false;
            for(int i = 0; i < n; i++) {
                if(a[i] > 1) {isBreak = true; break;}
                sum += a[i];
            }
            if(!isBreak) {
                int ones = (int) Math.floor((double) sum / 3);
                int mod = sum % 3;
                int count = 0;
                if (mod == 0) {
                    System.out.println(0);
                } else {
                    System.out.println(1);
                }
                System.out.print("1 ");
                for (int i = 0; i < a.length - 1; i++) {
                    if (a[i] == 1) {
                        count++;
                    }
                    if (count == ones + (mod < 1 ? 0 : 1)) {
                        count = 0;
                        mod--;
                        System.out.print(i + 2 + " ");
                    }
                }
            }
    }
}


// 10
// 1 1 1 1 1 1 1 0 1 1