jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, A;
  cin >> N >> A;
  string d = "No";

  for(int i=0; i<N/500; i++){
    for(int j=0; j<A; j++){
      if(500*i+j==N){
        d = "Yes";
        break;
      }

    }
    
  }


  cout << d << endl;


}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
int A,N;
  cin >> N  >>endl;
  cin >> A  >>endl;
  
if ((N%500) > A){
cout << "No" << endl;
}
  else ((N%500) <= A){
    cout << "Yes" << endl;
  }
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define LINE_BUF_SIZE 256

int main(){

    int A,N,R;

    scanf("%d %d", &N,&A);

    R = N % 500;

    if(R <= A){
        printf("Yes");
    }

    else{
        printf("No");
    }

    return 0;

}
//  [c]
#include<stdio.h>
int main()
{
    int N,A;
    scanf("%d%d",&N,&A);
    if(N%500 <= A)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
 
}
//  [c]
#include<stdio.h>
int main()

{
  int a,b,c;

  //金額
  scanf("%d", &a);

  //一円玉の枚数
  scanf("%d", &b);

  c= a%500;

  //判定
  if ( c <= b)
       printf("Yes\n");

  else printf("No\n");

  return 0;

}
//  [c]
#include<stdio.h>
int main(void) {
	int N, A,amari;
	scanf("%d %d", &N, &A);
	amari = N % 500;

	if (amari <= A) {
		printf("YES");
	}
	else
		printf("NO");

	return 0;
}
//  [c]
#include<stdio.h>
int main(void) {
	int N, A,amari;
	scanf_s("%d%d", &N, &A);
	amari = N % 500;

	if (amari <= A) {
		printf("YES");
	}
	else
		printf("NO");

	return 0;
}
//  [javascript]
function Main(input) {
  input = input.trim()
 input = input.split("\n").map(Number);
if(input[0]%500<=input[1]){
  console.log("Yes")
}else{
  console.log("No")
}
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
    var a = input[0]-0;
    var b = input[1]-0;
    console.log(a%500<=b?"Yes":"No")
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").split("\n"));
//  [javascript]
"use strict"

const main = (input) => {
    input = input.split("\n");
    const N = Number(input[0]);
    const A = Number(input[1]);

    if (N % 500 <= A) {
        console.log("Yes");
    } else {
        console.log("No");
    }
};

main(require("fs").readFileSync("/dev/stdin","utf8"));
//  [javascript]
// JavaScript source code
"use strict";

let myFunc = (input) => {
    input = input.split("\n");
    let N = parseInt(input[0]);
    let A = parseInt(input[1]);
    for(let i = 0; i < A; i++){
        if(i > N) break;
        if((N - i) % 500 === 0){
            console.log("Yes");
            return 0;
        }
    }
    console.log("No");
};

myFunc(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// JavaScript source code
"use strict";

let myFunc = (input) => {
    input = input.split("\n");
    let N = parseInt(input[0]);
    let A = parseInt(input[1]);
    for(let i = 0; i < A; i++){
        if((N - i) % 500 === 0){
            console.log("Yes");
            return 0;
        }
    }
    console.log("No");
};

myFunc(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input){
  input = input.split('\n');
  var N = parseInt(input[0],10);
  var A = parseInt(input[1],10);
  var num = N % 500;
  if(num <= A){
    console.log('YES');
  }else{
    console.log('NO');
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import "fmt"

func main() {
	var N, A int
	fmt.Scan(&N, &A)

	for N >= 500 {
		N = N - 500
	}

	if N <= A {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

import "fmt"

func main() {
	var n, a int
	fmt.Scan(&n, &a)

	if (n%500) <= a {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}
//  [go]
package main

import "fmt"

func main() {
	var n, a int
	fmt.Scan(&n, &a)

	if n%500 <= a {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main
 
import (
	"fmt"
)
 
func main() {
	var n, a int
	fmt.Scanf("%d", &n)
	fmt.Scanf("%d", &a)
	remand := n % 500
	if remand =< a {
		fmt.Printf("%s", "Yes")
	} else {
		fmt.Printf("%s", "No")
	}
}
//  [go]
package main

import "fmt"

func main() {
	var N, A int
	fmt.Scan(&N, &A)

	for N >= 500 {
		N = N - 500
	}

	if N < A {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n, a int
	fmt.Scan(&n, &a)
	n %= 500
	if n <= a {
		fmt.Println("Yes")
	} else {
		fmt.Println("Yes")
	}
}
//  [ruby]
n,a=2.times.map{gets.to_i}
puts n % 500 - a <= 0 ? "Yes" : "No"
//  [ruby]
Price = gets.strip.to_i
One = gets.strip.to_i

puts Price % 500 <= One ? 'Yes' : 'No'
//  [ruby]
n, a = readlines.map(&:to_i)
b = n%500

puts b > a ? "No" : "Yes"
//  [ruby]
N = gets.to_i
A = gets.to_i

d = N % 500
puts A > d ? "Yes" : "No"
//  [ruby]
a,b=`dd`.split.map(&:to_i)
puts a%500<=b? "Yes":"No"
//  [ruby]
a,b=`dd`.split.map(&:to_i)
puts a%500<=b?"Yes":"No"
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n:u32,
        a:u32,
    };
    println!("{}", if n % 500 <= a {"Yes"} else {"No"});
}
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let a: usize = read();

    println!(
        "{}",
        match n % 500 <= a {
            true => "Yes",
            false => "No",
        }
    )
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
    n: usize,
    a: usize,
    }
    let mut n = n;
    n %= 500;
    let ans = if n <= a {"Yes"} else { "No"};
    println!("{}", ans);
}
//  [rust]
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Usize1};
use proconio::{fastout, input};
#[fastout]
fn main() {
    input! {
        n: usize,
        a: usize,
    }
    let amari = n % 500;
    if amari < a {
        println!("Yes");
    } else {
        println!("No");
    }
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::read::bytes(std::io::bufreader::new(stdin.lock()));
        let mut next = move || -> string{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, string).chars().collect::<vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("parse error")
    };
}

fn main() {
    input!{
    n: usize,
    a: usize,
    }
    let mut n = n;
    n %= 500;
    let ans = if n <= a {"yes"} else { "no"};
    println!("{}", ans);
}
//  [rust]

fn main(){
    let mut n =  String::new();
    let mut a =  String::new();
    std::io::stdin().read_line(&mut n).expect("Failed read line");
    std::io::stdin().read_line(&mut a).expect("Failed read line");

    let n: u32 = match n.trim().parse() {
        Ok(num) => num,
        Err(_) => 1,
    };

    let a: u32 = match a.trim().parse() {
        Ok(num) => num,
        Err(_) => 1,
    };

    if n % 500 < a {
        println!("Yes");
    } else {
        println!("No");
    }

}
//  [swift]
print(Int(readLine()!)!%500>Int(readLine()!)! ?"No":"Yes")
//  [swift]
import Glibc
extension String: CollectionType {}

//var inp = readLine()!.split(" ").map { Int($0)! }
var n = Int(readLine()!)!
var a = Int(readLine()!)!
if n%500 <= a {
  print("Yes")
} else {
  print("No")
}
//  [swift]
import Foundation
 
var N = Int(readLine()!)!
//String -> Intの型変換はnilが返る可能性があるので、ラップされたOptional<Int>型が返るので強制アンラップ
var A = Int(readLine()!)!

if (N % 500 > A){
    print("No")
}else{
    print("Yes")
}
//  [swift]
import Foundation
 
let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ") //ブランクで区切られている場合
 
var N = Int(readLine()!)!
//String -> Intの型変換はnilが返る可能性があるので、ラップされたOptional<Int>型が返るので強制アンラップ
var A = Int(readLine()!)!

if (N % 500 > A){
    print("No")
}else{
    print("Yes")
}
//  [swift]
import Foundation
 
let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ") //ブランクで区切られている場合
 
var N = Int(split[0])!
//String -> Intの型変換はnilが返る可能性があるので、ラップされたOptional<Int>型が返るので強制アンラップ
var A = Int(split[1])!

if (N % 500 > A){
    print("No")
}else{
    print("Yes")
}
//  [swift]
import Foundation
 
let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ") //ブランクで区切られている場合
 
var N = Int(split[0])!
//String -> Intの型変換はnilが返る可能性があるので、ラップされたOptional<Int>型が返るので強制アンラップ
var A = Int(split[1])!

if (N % 500 > A){
    print(No)
}else{
    print(Yes)
}
//  [typescript]
function Main(input) {
    input = input.split('\n');
    var N = Number(input[0]);
    var A = Number(input[1]);
    console.log(N % 500 <= A ? 'Yes' : 'No');
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const [n, a] = stdin
  .split('\n')
  .filter(e => e)
  .map(Number)

const mod = n % 500

let res = 'No'

if (mod === 0) res = 'Yes'

if (mod <= a) res = 'Yes'

console.log(res)
//  [typescript]
const log = console.log;

const parseLines = (s: string) => s.trim().split("\n");
const parseDecimalInt = (s: string) => parseInt(s);

// ----

function Main(input: string): void {
  const [n, a] = parseLines(input).map(parseDecimalInt);

  log(n % 500 <= a ? "Yes" : "No");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
function Main(input) {
    input = input.split('\n');
    var N = Number(input[0]);
    var A = Number(input[1]);
    console.log(N % 500 < A ? 'Yes' : 'No');
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const log = console.log;

const parseLines = (s: string) => s.trim().split("\n");
const parseDecimalInt = (s: string) => parseInt(s);

// ----

function Main(input: string): void {
  const [n, a] = parseLines(input).map(parseDecimalInt);

  log(((n / 500) | 0) <= a ? "Yes" : "No");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
n = int(input())
a = [0] + list(map(int, input().split()))
x = a[:]
ans = []
for i in range(n, 0, -1):
    j = 2 * i
    while j <= n:
        x[i] ^= x[j]
        j += i
    if x[i] == 1:
        ans.append(i)

print(len(ans))
if ans:
    print(' '.join(list(map(str, ans))))
//  [python]
n = int(input())
a = [0] + list(map(int, input().split()))
ans = []
for i in range(n, 0, -1):
    j = 2 * i
    while j <= n:
        a[i] ^= a[j]
        j += i
    if a[i] == 1:
        ans.append(i)
print(len(ans))
if ans:
    print(' '.join(list(map(str, ans))))
//  [python]
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

def main():
	n=II()
	A=[0]+LI()
	B=[0]*(n+1)

	for i in range(n,0,-1):
		a=A[i]
		if n//i>=2:
			for j in range(2,n//i+1):
				#print(i,j)
				a^=B[i*j]
		B[i]=a

	ans=[]
	for i,v in enumerate(B):
		if v:
			ans.append(i)

	print(len(ans))
	print(*ans)













if __name__ == "__main__":
	main()
//  [python]
import sys


def IN_I(): return int(sys.stdin.readline().rstrip())
def IN_LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def IN_S(): return sys.stdin.readline().rstrip()
def IN_LS(): return list(sys.stdin.readline().rstrip().split())


N = IN_I()
a = [0] + IN_LI()
b = [0] * (N + 1)
ans = []

for i in range(N, 0, -1):
    tmp = 0
    for j in range(2 * i, N + 1, i):
        tmp += b[j]
    if tmp % 2 != a[i]:
        b[i] = 1
        ans.append(i)
if len(ans) == 0:
    print(0)
else:
    print(' '.join(map(str, ans)))
//  [python]
import sys


def IN_I(): return int(sys.stdin.readline().rstrip())
def IN_LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def IN_S(): return sys.stdin.readline().rstrip()
def IN_LS(): return list(sys.stdin.readline().rstrip().split())


N = IN_I()
a = IN_LI()
b = [0] * N

for i in range(N - 1, -1, -1):
    if a[i] == 1:
        b[i] = 1 - b[i]
        if (i + 1) % 2 == 0:
            b[i // 2] = 1
ans = []
for i in range(N):
    if b[i] == 1:
        ans.append(i + 1)

if len(ans) == 0:
    print(0)
else:
    print(' '.join(map(str, ans)))
//  [python]
def divisors(n):
   d=[]
   for i in range(1,int(n**0.5)+1):
       if n%i==0:
           d.append(i)
           if i!=n//i:
               d.append(n//i)
   d.sort()
   return d
n=int(input())
table=[0]*(n+1)
ball=[]
a=list(map(int,input().split()))[::-1]
for i in range(n):
    if table[n-i]!=a[i]:
        ball.append(n-i)
        for j in divisors(n-i):
            table[j]=1-table[j]
print(len(ball))
if len(ball)!=0:
    print(*ball)
//  [java]
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        boolean[] a = new boolean[N];
        for (int i = 0; i < N; i++) {
            a[i] = in.i() == 1;
        }

        boolean[] b = new boolean[N];
        for (int i = N; i > 0; i--) {
            boolean c = a[i - 1];
            for (int j = 2 * i - 1; j < N; j += i) {
                c ^= b[j];
            }
            b[i - 1] = c;
        }

        StringBuilder sb = new StringBuilder();
        int n = 0;
        for (int i = 0; i < N; i++) {
            if (b[i]) {
                sb.append(i + 1).append(' ');
                n++;
            }
        }
        out.println(n);
        out.println(sb);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}
//  [java]
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        boolean[] a = new boolean[N];
        for (int i = 0; i < N; i++) {
            a[i] = in.i() == 1;
        }

        boolean[] b = new boolean[N];
        for (int i = N; i > 0; i--) {
            boolean c = false;
            for (int j = i - 1; j < N; j += i) {
                c ^= a[j];
            }
            b[i - 1] = c;
        }

        StringBuilder sb = new StringBuilder();
        int n = 0;
        for (int i = 0; i < N; i++) {
            if (b[i]) {
                sb.append(i + 1).append(' ');
                n++;
            }
        }
        out.println(n);
        out.println(sb);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}
//  [cpp]
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int dm = 1 << 21;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) *di++ = (*(C + i));
	*di++ = '\n';
}
bool b[200001];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	char c;
	int N = 0;
	while ((c = getchar_unlocked()) >= '0') N = N * 10 + c - '0';

	bool a[200001];
	rep1(i, N) {
		a[i] = getchar_unlocked() - '0';
		getchar_unlocked();
	}

	int kazu = 0;
	for (int i = N; i > 0; i--) {
		bool k = a[i];
		for (int j = i + i; j <= N; j += i) {
			k ^= b[j];
		}
		if (k) {
			kazu++;
			b[i] = true;
		}
	}
	if (kazu == 0) {
		*di++ = '0';
		*di++ = '\n';
	}
	else putint(kazu);
	rep1(i, N) {
		if (b[i]) putint(i);
	}
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int A[200000];
int ball[200000];
int M;
int B[200000];
int main(){
  int i, j, k;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  for(k=N;k;k--){
    j = A[k-1];
    for(i=k;i<=N;i+=k){
      j ^= ball[i-1];
    }
    ball[k-1] = j;
  }
  for(i=0;i<N;i++){
    if(ball[i]){
      B[M++] = i+1;
    }
  }
  wt_L(M);
  wt_L('\n');
  {
    int KL2GvlyY;
    if(M==0){
      putchar_unlocked('\n');
    }
    else{
      for(KL2GvlyY=0;KL2GvlyY<M-1;KL2GvlyY++){
        wt_L(B[KL2GvlyY]);
        wt_L(' ');
      }
      wt_L(B[KL2GvlyY]);
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20190715-1

// --- original code ---
// int N, A[2d5];
// 
// int ball[2d5];
// int M, B[2d5];
// {
//   int i, j, k;
//   rd(N,A(N));
// 
//   for(k=N;k;k--){
//     j = A[k-1];
//     for(i=k;i<=N;i+=k) j ^= ball[i-1];
//     ball[k-1] = j;
//   }
// 
//   rep(i,N) if(ball[i]) B[M++] = i+1;
//   wt(M);
//   wt(B(M));
// }
//  [cpp]
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
inline void write(int x)
{
    if(x<0)putchar('-'),x=-x;
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int a[200010],ans[200010];
int top,sta[200010];
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
    int n=read();
    for(int i=1;i<=n;i++)a[i]=read();
    for(int i=n;i>=1;i--)
    {
    	int sum=0;
    	for(int j=2*i;j<=n;j+=i)sum+=ans[j];
    	sum%=2;
    	if(sum!=a[i]){ans[i]=1;sta[++top]=i;}
    }pr2(top);
    for(int i=1;i<=top;i++)pr1(sta[i]);
    return 0;
}
//  [cpp]
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}
int main() {
    ll n; cin >> n;
    vector<ll> a(n+1, 0);
    REP(i, n) {
        cin >> a[i+1];
    }

    vector<ll> res(n+1, 0);
    ll num = 0;
    FORD(i, n, 1) {
        if (i * 2 > n) {
            res[i] = a[i];
        } else {
            ll tot = 0;
            for (ll j=i+i; j<=n; j+=i) {
                if (a[j] == 1) {
                    tot += res[j];
                }
            }
            if (tot % 2 != a[i]) {
                res[i] = 1;
                num++;
            }
        }
    }
    cout << num << endl;
    ll f = true;
    REP(i, res.size()-1) {
        if (res[i+1] == 1) {
            if (!f) {
                cout << " ";
            }
            cout << i + 1;
            f = false;
        }
    }
    return 0;
}
//  [cpp]
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}
int main() {
    ll n; cin >> n;
    vector<ll> a(n+1, 0);
    REP(i, n) {
        cin >> a[i+1];
    }

    vector<ll> res(n+1, 0);
    ll num = 0;
    FORD(i, n, 1) {
        ll tot = 0;
        for (ll j=i+i; j<=n; j+=i) {
            if (a[j] == 1) {
                tot += res[j];
            }
        }
        if (tot % 2 != a[i]) {
            res[i] = 1;
            num++;
        }
    }
    cout << num << endl;
    ll f = true;
    REP(i, res.size()-1) {
        if (res[i+1] == 1) {
            if (!f) {
                cout << " ";
            }
            cout << i + 1;
            f = false;
        }
    }
    return 0;
}
//  [cpp]
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}
int main() {
    ll n; cin >> n;
    vector<ll> a(n, 0);
    REP(i, n) {
        cin >> a[i];
    }

    vector<ll> res(n, 0);
    ll num = 0;
    FORD(i, n-1, 0) {
        ll tot = 0;
        for (ll j=i+1; j<n; j+=1) {
            // cout << j << endl;
            tot += res[j];
        }
        if (tot % 2 != a[i]) {
            res[i] = 1;
            num++;
        }
    }
    cout << num << endl;
    ll f = true;
    REP(i, res.size()-1) {
        if (res[i] == 1) {
            if (!f) {
                cout << " ";
            }
            cout << i + 1;
            f = false;
        }
    }
    return 0;
}
//  [c]
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

char a[200001], b[200001];
int main(void){
	int n, i, j;
	scanf("%d", &n);
	for(i=1; i<=n; i++){
		int A;
		scanf("%d", &A);
		a[i]=A;
	}
	int ans=0;
	for(i=n; i>0; i--){
		int c=a[i];
		for(j=i*2; j<=n; j+=i){
			c+=b[j];
		}
		if((c&1)!=0){
			b[i]=1;
			ans++;
		}else{
			b[i]=0;
		}
	}
	printf("%d\n", ans);
	for(i=1; i<=n; i++){
		if(b[i]!=0)
			printf("%d ", i);
	}
	putchar(10);
}
//  [c]
#include<stdio.h>

int main(void){
    int n;
    register int i,j;
    scanf("%d",&n);
    int a[n];
    for(i = 0;i < n;i++)scanf("%d",&a[i]);
    short b[n];
    int al = n/2;
    int tmp = 0;
    for(i = al;i < n;i++)b[i] = a[i];
    for(i = al - 1;i >= 0;i--){
        tmp = 0;
        for(j = 2;(i+1) * j <= n;j++)tmp += b[(i+1)*j-1];
        tmp %= 2;
        b[i] = (tmp == a[i] ? 0:1);
    }
    int ans = 0;
    for(i = 0;i < n;i++)ans += b[i];
    printf("%d\n",ans);
    if(!ans)return 0;
    for(i = 0;i < n;i++)if(b[i])printf("%d ",i+1);
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define a(i) (*(A+(i)-1))
#define b(i) (*(B+(i)-1))

int N;
char *A;
char *B;

int main(int argc, char *argv[]) {
	int sr;
	int inp;
	int i,j;
	int sum;

	sr=scanf("%d", &N);

	A = malloc(sizeof(int)*N);
	B = malloc(sizeof(int)*N);
	for (i=1; i<=N; i++) {
		sr=scanf("%d", &inp);
		a(i) = inp;
		if (i*2>N) b(i) = a(i);
	}

	for (i=N/2; i>=1; i--) {
		sum=a(i);
		for (j=2; j*i<=N; j++) {
			sum+=b(j*i);
		}
		b(i)=sum%2;
	}

	sum=0;
	for (i=1; i<=N; i++) {
		if (b(i)) sum++;
	}
	printf("%d\n", sum);
	for (i=1; i<=N; i++) {
		if (b(i)) {
			printf("%d", i);
			sum--;
			if (sum>0) {
				printf(" ");
			} else {
				printf("\n");
				break;
			}
		}
	}

	return 0;

}

/*
問題文
N
 個の空の箱が横一列に並んでいます。 左から 
i (1≦i≦N) 番目の箱には整数 i が書かれています。

すぬけさんは、それぞれの箱に対してボールを 1 個入れるか何も入れないかを選ぶことができます。

ここで、以下の条件を満たすようなボールの入れ方を、いいボールの入れ方と定めます。

	・1 以上 N 以下の任意の整数 i について、 i の倍数が書かれた箱に入っているボールの個数の和を 2 で割った余りが a_i である。
いいボールの入れ方は存在するでしょうか。存在するならば 1 つ求めてください。

制約
・入力は全て整数である。
・1≦N≦2 × 10^5
・a_i は 0 または 1 である。


N/2番目以降の箱のボールの数はa_i（その箱より大きい倍数の箱はないから)
i番目の箱の数は、iより大きい倍数の箱のボールの和が偶数なら0、奇数なら1

N/2以上の箱のボールの数によって、i≦N/2番目までのボールの和が決まる。

A_i: i番目の箱に入っているボールの数
A_i = a_i (i≧N/2)

A_i+A_2i+A_3i+...+A_(k-1)i+a_ki
*/
//  [c]
#include <stdio.h>

int main()
{
	int i, N, a[100001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(a[i]));
	
	int j, box[100001] = {}, sum = 0;
	for (i = N; i >= 1; i--) {
		for (j = 2; i * j <= N; j++) a[i] ^= box[i*j];
		box[i] = a[i];
		sum += box[i];
	}
	
	printf("%d\n", sum);
	for (i = 1; i <= N; i++) if (box[i] == 1) printf("%d ", i);
	fflush(stdout);
	return 0;
}
//  [c]
#include <stdbool.h>
#include <stdio.h>
int main() {
	int n, m = 0;
	bool a[200000], ball[200000];
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		ball[i] = false;
	}
	for (int i = n; i > 0; i--) {
		int cnt = 0;
		for (int j = 1; j <= n / i; j++) {
			if (ball[i * j - 1]) {
				cnt++;
			}
		}
		if (cnt % 2 != a[i - 1]) {
			ball[i - 1] = true;
			m++;
		}
	}
	printf("%d\n", m);
	for (int i = 0; i < n; i++) {
		if (ball[i]) {
			printf("%d ", i + 1);
		}
		return 0;
	}
}
//  [javascript]
module.exports=function(e){var r={};function n(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)n.d(t,o,function(r){return e[r]}.bind(null,o));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=0)}([function(e,r,n){n(1)(n(2).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(e,r){e.exports=function(e){for(var r=Number(e[0]),n=e[1].split(" ").map(function(e){return Number(e)}),t=new Array(r+1).fill(0),o=r;o>=1;o--){for(var u=o,i=0;u<=r;)i+=t[u],u+=o;i%2!=n[o-1]&&(t[o]=1)}for(var f=0,l=[],c=1;c<=r;c++)1==t[c]&&(f++,l.push(c));console.log(f),l.length>0&&console.log(l.join(" "))}},function(e,r){e.exports=require("fs")}]);
//  [javascript]
var obj = init();
Main();
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");}
function init(){
  var inputFile = myin();
  var returnObj = {
    "list" : inputFile, "index" : 0, "max" : inputFile.length,
    "hasNext" : function(){return (this.index < this.max);},
    "next" : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var N = nextInt();
  var list = nextIntArray();
  list.unshift(0);
  var count = new Array(N + 1).fill(0);
  var outputM = 0;
  var outputlist = [];
  for(var i = N; i > 0; i--){
    var sum = 0;
    var j = 1;
    while(i * j <= N){
      sum += count[i * j];
      j++;
    }
    if(sum % 2 != list[i]){
      count[i]++;
      outputM++;
      outputlist.push(i);
    }
  }
  myout(outputM);
  if(outputM > 0){
  	myout(myconv(outputlist,8));
  }
}
//  [javascript]


function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  var a = input[1].split(" ").map(i => parseInt(i));
  var bb = new Array(N).fill(0);
  var bsub = new Array();
  var num = 0;
  for(var i=N;i>0;i--){
    var cnt =0;
    for(var j=1;j*i<=N;j++){
      cnt+=bb[j*i-1];
    }
    if(cnt%2!=a[i-1]){
      num++;
      bsub.push(i);
      bb[i-1]++;
    }
  }
  var b = bsub.join(" ");
  var ans = num+"\n"+b;
  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
console.log((args=>{
  const [[N],a] = args.trim().split('\n').map(r=>r.split(' ').map(v=>v|0));
  const b = [];
  for ( let i = 0; i < N; i++ ) {
    let s = 0;
    for ( let j = i; j < N; j+=i+1 ) s ^= a[j];
    if ( s !== a[i] ) return '-1';
    else if ( s ) b.push(i+1);
  }
  return b.length + '\n' + b.join` `;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
//  [javascript]
"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'));
//  [javascript]
var obj = init();
Main();
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function next(){return obj.next();}
function hasNext(){return obj.hasNext();}
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");}
function init(){
  var inputFile = myin();
  var returnObj = {
    "list" : inputFile, "index" : 0, "max" : inputFile.length,
    "hasNext" : function(){return (this.index < this.max);},
    "next" : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  myout(-1);
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	a := iSScan(n)
	c := make([]int, n)
	ans := make([]int, 0, n)
	for i := n - 1; i >= 0; i-- {
		x := 0
		for j := (i+1)*2 - 1; j < n; j += i + 1 {
			x += c[j]
		}
		c[i] = abs(a[i] - x%2)
		if c[i] == 1 {
			ans = append(ans, i+1)
		}
	}
	fmt.Println(len(ans))
	if len(ans) != 0 {
		fmt.Println(strings.Trim(fmt.Sprint(ans), "[]"))
	}
}
//  [go]
package main

import (
	"bufio"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	oddEven := make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		oddEven[i], _ = strconv.Atoi(sc.Text())
	}

	boals := make([]int, n)
	for i := n - 1; i >= 0; i-- {
		count := 0
		for j := 2; j*(i+1) <= n; j++ {
			count += boals[j*(i+1)-1]
		}

		if oddEven[i] != count%2 {
			boals[i] = 1
		}
	}

	count := 0
	displayNumbers := make([]int, 0)
	for i, exist := range boals {
		if exist == 0 {
			continue
		}
		count += exist
		displayNumbers = append(displayNumbers, i+1)
	}

	writer := bufio.NewWriter(os.Stdout)

	writer.WriteString(strconv.Itoa(count) + "\n")

	for i, el := range displayNumbers {
		if i != 0 {
			writer.WriteString(" " + strconv.Itoa(el))
		} else {
			writer.WriteString(strconv.Itoa(el))
		}
	}

	if count != 0 {
		writer.WriteString("\n")
	}

	writer.Flush()
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a := make([]int, n)
	for i := range a {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
	}

	b := make([]int, n)
	ans := make([]int, 0, n)
	for i := len(a); i >= 1; i-- {
		x := 0
		for j := 2; j <= n; j++ {
			if i*j > n {
				break
			}
			x ^= b[i*j-1]
		}
		b[i-1] = x ^ a[i-1]
		if b[i-1] == 1 {
			ans = append(ans, i)
		}
	}

	fmt.Println(len(ans))

	wr := bufio.NewWriter(os.Stdout)
	for i, v := range ans {
		if i == len(ans)-1 {
			wr.WriteString(strconv.Itoa(v) + "\n")
			continue
		}
		wr.WriteString(strconv.Itoa(v) + " ")
	}
	wr.Flush()
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	a := iSScan(n)
	c := make([]int, n)
	ans := make([]int, 0, n)
	for i := n - 1; i >= 0; i-- {
		x := 0
		for j := (i+1)*2 - 1; j < n; j += i + 1 {
			x += c[j]
		}
		c[i] = a[i] - x%2
		if c[i] == 1 {
			ans = append(ans, i+1)
		}
	}
	fmt.Println(len(ans))
	if len(ans) != 0 {
		fmt.Println(strings.Trim(fmt.Sprint(ans), "[]"))
	}
}
//  [ruby]
n = gets.to_i
a = [0] + gets.split.map(&:to_i)
n.downto(1) do |i|
  j = i
  b = 0
  while j <= n
    b += a[j]
    j += i
  end
  a[i] = b % 2
end
puts a.sum
1.upto(n) do |i|
  puts i if a[i] == 1
end
//  [ruby]
n = gets.to_i
a = [0] + gets.split.map(&:to_i)

(n/2).downto(1) do |i|
  s = 0
  j = i
  while j <= n do
    s += a[j]
    j += i
  end
  a[i] = s & 1
end

ans = (1..n).select{ |i| a[i] == 1 }
puts ans.size, ans * " "
//  [ruby]
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def r_sort(a) a.sort{|a,b|b<=>a} end

n = inp[0]
a = [0]+inp
t = na(n+1,0)
ans = []
((n/2+1)..n).each do |i|
  if(1 == a[i])
    t[i] = 1
    ans.push(i)
  end
end
(1..(n/2)).reverse_each do |i|
  d = i+i
  c = 0
  while d <= n
    c += t[d]
    d += i
  end
  if(c%2 != a[i])
    t[i] = 1
    ans.push(i)
  end
end
puts ans.size
puts ans.join(" ") if(ans.size > 0)
//  [ruby]
n = gets.to_i
a = gets.chomp.split.map(&:to_i)
a.unshift(0)
res = Hash.new(0)

n.step(1, - 1) do |i|
  if i <= n / 2
    t = (1..n).to_a.select {|j| j % i == 0 }.inject(0) {|acc, x| acc + a[x] }
    if t != a[i]
      res = nil
      break
    end
  end

  if a[i] != 0
    res[i] = a[i]
  end
end

if res.nil?
  puts "-1"
else
  puts res.keys.size
  puts res.keys.join(" ")
end
//  [ruby]
n = gets.to_i
a = gets.split.map(&:to_i)
b = Array.new(n + 1) { 0 }

a.reverse_each.with_index do |e, idx|
  b[n - idx] = 1 if e != Array.new(n / (n - idx) - 1) { |i| b[(n - idx) * (i + 2)] }.sum % 2
end

if (idx = b.rindex(1))
  puts idx
  puts b[1, idx].join(' ')
else
  puts 0
end
//  [ruby]
require 'prime'

N=gets.to_i
array=gets.chomp.split(" ").map(&:to_i)

def _divisors(primes, k)
    Enumerator.new do |y|
      if primes.size == k
        y << 1
      else
        p, e = primes[k]
        _divisors(primes, k + 1).each {|d|
          (e + 1).times {|e1|
            y << p ** e1 * d
          }
        }
      end
    end
end
  
def divisors(n)
    _divisors(Prime.prime_division(n), 0).to_a.sort
end

b_array=Array.new(N,0)
N.downto(1) do |i|
    sum = 0
    target = i*2
    while target <= N do
        sum = (sum + array[target-1])%2
        target += i
    end
    if sum != array[i-1]
        b_array[i-1]=1
    end
end

m = 0
rets = []
b_array.each_with_index do |b,index|
    if b != 0
        m += 1
        rets.push(index+1)
    end
end
puts m
puts rets.join(" ") if m > 0