"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const A = arg[1].split(" ").map(n=>parseInt(n));
    
    const B = [];
    
    // 大きい方から見ていく
    for(let i=N-1; i>=0; i--) {
        if(A[i] === 0) {
        //   B[i] = 0;  
        } else {
          B.push(i+1)
        }
    }
    
    console.log(B.length);
    console.log(B.join(" "))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
