import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array,
  std.functional, std.container, std.typecons;

void main() {
  int N = readln.split[0].to!int;
  int[] a = readln.split.to!(int[]);

  int[] ans = new int[N];
  foreach_reverse(i, c; a) {
    ulong n = i + 1;
    ans[i] = c ^ iota(i, N, n).map!(j => ans[j]).reduce!"a ^ b";
  }

  int cnt = ans.reduce!"a+b";
  writeln(cnt);
  foreach(i, c; ans) {
    if(c == 1) write(i+1, " ");
  }
}
