import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.Scanner;

class BIT {
	long bit[] = new long[0];
	int N = 0;

	BIT(int n) {
		bit = new long[n + 1];
		N = n;
	}

	void add(int a, long w) {
		for (int x = a; x < N; x += (x & -x))
			bit[x] += w;
	}

	long sum(int a) {
		long ret = 0;
		for (int x = a; x > 0; x -= x & -x)
			ret += bit[x];
		return ret;
	}

	long modsum(int a, int mod) {
		long ret = 0;
		for (int x = a; x > 0; x -= x & -x) {
			ret += bit[x];
			ret %= mod;
		}
		return ret;
	}
}
class MODBIT {
	long bit[] = new long[0];
	int N = 0;
	int mod=0;
	MODBIT(int n,int m) {
		bit = new long[n + 1];
		N = n;
		mod=m;
	}

	void add(int a, long w) {
		for (int x = a; x < N; x += (x & -x)) {
			bit[x] += w;
			bit[x] %= mod;
		}
	}

	long modsum(int a, long mod2) {
		long ret = 0;
		for (int x = a; x > 0; x -= x & -x) {
			ret += bit[x];
			ret %= mod2;
		}
		return ret;
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public char nextchar() {
		return next().charAt(0);
	}
}

class UnionFind {
	int Parent[];

	UnionFind(int n) {// Initialize by -1
		Parent = new int[n];
		Arrays.fill(Parent, -1);
	}

	int root(int A) {// In which tree is A?
		if (Parent[A] < 0)
			return A;
		return Parent[A] = root(Parent[A]);
	}

	int size(int A) {// size of tree which is include A
		return -Parent[root(A)];
	}

	boolean connect(int A, int B) {// Connect A and B
		A = root(A);
		B = root(B);
		if (A == B)
			return false;
		if (size(A) < size(B)) {
			int C = 0;
			C = B;
			B = A;
			A = C;
		} // SWAP
		Parent[A] += Parent[B];
		Parent[B] = A;
		return true;
	}
}

class Pair<T, E> {
	public T first;
	public E second;

	void set(T x, E y) {
		first = x;
		second = y;
	}
}

class Pint {
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Pint) {
			Pint other = (Pint) obj;
			return other.first == this.first && other.second == this.second;
		}
		return false;
	}

	@Override
	public int hashCode() {
		return Objects.hash(this.first, this.second);
	}

	public int first;
	public int second;

	Pint(int x, int y) {
		first = x;
		second = y;
	}

	void set(int x, int y) {
		first = x;
		second = y;
	}
}

class Tpair {
	public int first;
	public int second;
	public long third;

	Tpair(int x, int y, long z) {
		first = x;
		second = y;
		third = z;
	}

	void set(int x, int y, long z) {
		first = x;
		second = y;
		third = z;
	}
}
class Comb{
	int N=0;
	int mod=0;
	long fact[],ifact[],inv[];
	Comb(int n,int m){
		N=n;
		mod=m;
		fact=new long[N+10];
		ifact=new long[N+10];
		inv=new long[N+10];
		inv[1] = 1;
		for (int i = 2; i < N; i++) inv[i] = 1l * (mod - mod / i) * inv[mod % i] % mod;
		fact[0] = ifact[0] = 1;
		for (int i = 1; i < N; i++) {
			fact[i] = 1l * fact[i - 1] * i % mod;
			ifact[i] = 1l * ifact[i - 1] * inv[i] % mod;
		}
	}
	public long C(int x,int y) {
		if (x < 0 || y < 0 || x < y) return 0;
		return 1l * fact[x] * ifact[y] % mod * ifact[x - y] % mod;
	}
}
public class Main {
	static FastScanner scan = new FastScanner();
	static Scanner scanner = new Scanner(System.in);
	static Random rand = new Random();
	static int mod = 1000000007;
	static double eps = 1.0E-14;
	static int big = Integer.MAX_VALUE;
	static double PI = 3.141592653589793;

	static long modlcm(long a, long b) {
		return a * b * modinv(GCD(a, b), mod);
	}

	static long GCD(long a, long b) {
		return b > 0 ? GCD(b, a % b) : a;
	}

	static long lcm(long a, long b) {
		return a * b / GCD(a, b);
	}

	static int min(int a, int b) {
		return a < b ? a : b;
	}

	static long factorial(int i) {
		return i == 1 ? 1 : i * factorial(i - 1);
	}

	static int max(int... i) {
		int x = i[0];
		for (int e : i)
			x = Math.max(x, e);
		return x;
	}

	static int min(int... i) {
		int x = i[0];
		for (int e : i)
			x = Math.min(x, e);
		return x;
	}

	static long gcd(long... i) {
		long x = i[0];
		for (long e : i)
			x = GCD(x, e);
		return x;
	}

	static long lmax(long... i) {
		long x = i[0];
		for (long e : i)
			x = Math.max(x, e);
		return x;
	}

	static long lmin(long... i) {
		long x = i[0];
		for (long e : i)
			x = Math.min(x, e);
		return x;
	}

	static long nCr(long n, long r, long m) {
		long ans = 1;
		for (long i = 0; i < r; i++) {
			ans *= (n - i);
			ans %= m;
		}
		for (long i = 0; i <= r; i++) {
			ans *= modinv(i, m);
			ans %= mod;
		}
		return ans;
	}

	static int lower_bound(long[] b, long cost) {
		int ok = b.length;
		int ng = -1;
		while (Math.abs(ok - ng) > 1) {
			int mid = (ok + ng) / 2;
			if (b[mid] >= cost)
				ok = mid;
			else
				ng = mid;
		}
		return ok;
	}

	static int upper_bound(int[] b, int cost) {
		int ok = b.length;
		int ng = -1;
		while (Math.abs(ok - ng) > 1) {
			int mid = (ok + ng) / 2;
			if (b[mid] > cost)
				ok = mid;
			else
				ng = mid;
		}
		return ok;
	}

	static boolean isPrime(long n) {
		if (n == 2)
			return true;
		if (n < 2 || n % 2 == 0)
			return false;
		double d = Math.sqrt(n);
		for (int i = 3; i <= d; i += 2)
			if (n % i == 0) {
				return false;
			}
		return true;
	}

	static int upper_division(int a, int b) {
		if (a % b == 0) {
			return a / b;
		} else {
			return a / b + 1;
		}
	}

	static long lupper_division(long a, long b) {
		if (a % b == 0) {
			return a / b;
		} else {
			return a / b + 1;
		}
	}

	static int[] setArray(int a) {
		int b[] = new int[a];
		for (int i = 0; i < a; i++) {
			b[i] = scan.nextInt();
		}
		return b;
	}

	static long[] lsetArray(int a) {
		long b[] = new long[a];
		for (int i = 0; i < a; i++) {
			b[i] = scan.nextLong();
		}
		return b;
	}

	static String reverse(String str) {
		char ch[] = new char[str.length()];
		char chch[] = str.toCharArray();
		int a = str.length();
		for (int i = 0; i < upper_division(a, 2); i++) {
			ch[i] = chch[ch.length - i - 1];
			ch[ch.length - 1 - i] = chch[i];
		}
		return String.valueOf(ch);
	}

	public static void printArray(int[] que) {
		for (int i = 0; i < que.length - 1; i++) {
			System.out.print(que[i] + " ");
		}
		System.out.println(que[que.length - 1]);
	}

	public static void lprintArray(long[] que) {
		for (int i = 0; i < que.length - 1; i++) {
			System.out.print(que[i] + " ");
		}
		System.out.println(que[que.length - 1]);
	}

	public static int[][] doublesort(int[][] a) {
		Arrays.sort(a, (x, y) -> Integer.compare(x[0], y[0]));
		return a;
	}

	public static long[][] ldoublesort(long[][] a) {
		Arrays.sort(a, (x, y) -> Long.compare(x[0], y[0]));
		return a;
	}

	static long modpow(long x, long n, long mo) {
		long sum = 1;
		while (n > 0) {
			if ((n & 1) == 1) {
				sum = sum * x % mo;
			}
			x = x * x % mo;
			n >>= 1;
		}
		return sum;
	}

	public static char[] revch(char ch[]) {
		char ret[] = new char[ch.length];
		for (int i = ch.length - 1, j = 0; i >= 0; i--, j++) {
			ret[j] = ch[i];
		}
		return ret;
	}

	public static int[] revint(int ch[]) {
		int ret[] = new int[ch.length];
		for (int i = ch.length - 1, j = 0; i >= 0; i--, j++) {
			ret[j] = ch[i];
		}
		return ret;
	}

	public static void warshall_floyd(long v[][]) {
		int n = v[0].length;
		for (int k = 0; k < n; k++)
			for (int i = 0; i < n; i++)
				for (int j = 0; j < n; j++)
					v[i][j] = lmin(v[i][j], v[i][k] + v[k][j]);
	}

	public static long modinv(long a, long m) {
		long b = m, u = 1, v = 0;
		while (b != 0) {
			long t = a / b;
			a -= t * b;
			long x = a;
			a = b;
			b = x;
			u -= t * v;
			x = u;
			u = v;
			v = x;
		}
		u %= m;
		if (u < 0)
			u += m;
		return u;
	}

	public static long lmod(long i, long j) {
		return (i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
	}

	public static int next_combination(int sub) {
		int x = sub & -sub, y = sub + x;
		return (((sub & ~y) / x) >> 1) | y;
	}
	public static void main(String[] $) throws IOException {
		int n=scan.nextInt();
		int a[]=setArray(n);
		System.out.println(-1);
	}
}


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;
    }
}


//#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;
}


#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));
// }


#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;
}


#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;
}


#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;
}


#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;
}


#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);
}


#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;
}


#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
*/


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
#include<assert.h>
#include<ctype.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define rrep(i,l,r)for(ll i=(l);i>=(r);i--)
#define INF (1LL<<60)
#define MOD1 1000000007
#define MOD2 998244353
#define MAX_N (1 << 20)
#define YES printf("Yes\n")
#define NO printf("No\n")
#define PN printf("\n")
#define charsize 100005 //10^5+5
#define PI 3.141592653589793238

void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a= c;}
void cin(ll *n){ scanf("%lld",&(*n)); }
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll min3(ll a, ll b, ll c){return (a<=b && a<=c) ? a : b<=c ? b : c;}
ll max3(ll a, ll b, ll c){return (a>=b && a>=c) ? a : b>=c ? b : c;}
ll minn(ll n, ll a[]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
double POW_d(double a, double b){double c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll mod_MOD1(ll n){n+= n<0?((-n)/MOD1+1)*MOD1:0; return n%=MOD1;}
ll mod_p(ll n ,ll p){n+= n<0?((-n)/p+1)*p:0; return n%=p;}
ll change_into_num(char s[] , ll len, ll p){ return !p ? 0 : POW(10,p-1)*(s[len-p]-'0') + change_into_num(s,len,p-1); }
ll digits(ll a, ll b){return a/b?1+digits(a/b,b):1;}
ll base(ll n, ll a, ll i){return i==1?n%a:base(n/a,a,i-1);}

void lr_lower( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am < val ?  ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am <= val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }
void lr_upper( int *l, int *r, ll am, ll val , int type ){ (type<3) ? ( am <= val ?  ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ) : ( am < val ? ( *l = (*l+*r)/2 ) : ( *r= (*l+*r)/2 ) ); }
int cmp_lower( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a>=b ? 1 : 0 ) : ( a>b ? 1 : 0 ) ; }
int cmp_upper( ll a, ll b, int type ){ return (type==1) ? ( a==b ? 1 : 0 ) : (type==2) ? ( a<=b ? 1 : 0 ) : ( a<b ? 1 : 0 ) ; }
// return smallest p  which meets  a[p]==val :1  >=:2   >:3
ll lower_bound( ll a[], int l, int r, ll val , int type ){  while(r-l>1) lr_lower(&l,&r,a[ (l+r)/2 ],val,type);  return cmp_lower(a[l],val,type) ? l : cmp_lower(a[r],val,type) ? r : -1;  }
// return biggest p  which meets   a[p]==val :1  <=:2   <:3
ll upper_bound( ll a[], int l, int r, ll val , int type ){  while(r-l>1) lr_upper(&l,&r,a[ (l+r)/2 ],val,type); return cmp_upper(a[r],val,type) ? r : cmp_upper(a[l],val,type) ? l : -1; }
// count i  which meets ai==x
ll count(ll a[], int l, int r, ll x){  int p = lower_bound(a,l,r,x,1);  return p==-1 ? 0 : upper_bound(a,p,r,x,1)-p+1; }

ll *factors[2] , fac_cnt=0 , is_factor_prepared=0;
ll factor_pre(){  rep(i,0,1){ if(is_factor_prepared++) return 0; }  ll tmp=(1e6)/2+1, fac_tmp[tmp];  rep(i,0,tmp){fac_tmp[i]=i?2*i+1:2;}  rep(i,1,tmp){if(fac_tmp[i]){  repp(j,3,tmp/(2*i+1)+1,2 ){  if( j*(2*i+1)<tmp ) fac_tmp[ (j*(2*i+1)-1)/2 ]=0;  }  }else continue;}  rep(i,0,tmp){if(fac_tmp[i]){  rep(j,0,2){ factors[j] = realloc( factors[j] , sizeof(ll)*( fac_cnt +1 ) );  factors[j][j?fac_cnt++:fac_cnt]=j?0:fac_tmp[i];  }  } }  return 0;  }
ll factor(ll n, ll new_common_plus){ factor_pre();  rep(i,0,fac_cnt){ ll cnt=0; rep(j,0,1){ while( ( cnt+= n %factors[0][i]==0 ? 1 : 0 )  && (n/=factors[0][i]) %factors[0][i]==0 ) continue; } factors[1][i]= new_common_plus==1 ? cnt :  new_common_plus==2 ? max2(factors[1][i],cnt) : factors[1][i]+cnt ;  if( factors[0][i]> n ) break; } return n; }
ll judge_prime(ll n){ factor_pre(); rep(i,0,fac_cnt){ if(n<factors[0][i]*factors[0][i] || n==factors[0][i]) break; else if(n%factors[0][i]==0) n/=n; }  return n==1?0:1; }

ll *mf_arr,*inv_arr,*finv_arr,is_minv_made=0,is_mf_made=0;
ll makeinv(ll n , ll mod){  rep(i,0,1){if(is_minv_made++) return 0;}  inv_arr = realloc(inv_arr, sizeof(ll)*2 );  finv_arr = realloc(finv_arr, sizeof(ll)*2 );  inv_arr[1]=1;finv_arr[0]=finv_arr[1]=1;  rep(i,2,n+1){  inv_arr = realloc(inv_arr, sizeof(ll)*(i+1) );  finv_arr = realloc(finv_arr, sizeof(ll)*(i+1) );  inv_arr[i]= mod - inv_arr[mod%i] * (mod / i) % mod;  finv_arr[i] = finv_arr[i - 1] * inv_arr[i] % mod;  }  return 0; }
ll make_mf(ll n, ll mod){  rep(i,0,1){ if(is_mf_made++) return 0; }  mf_arr = realloc(mf_arr, sizeof(ll)*2 );  ll x=1;  mf_arr[0]=mf_arr[1]=x;  rep(i,2,n+1){   x=x*i%mod;  mf_arr = realloc(mf_arr, sizeof(ll)*(i+1) );  mf_arr[i]=x; }  return 0;  }
ll m_inv(ll x, ll mod, ll is_fac ){ makeinv(2*1e6+10,mod);  return is_fac?finv_arr[x]:inv_arr[x]; }
ll m_f(ll x, ll mod){  make_mf(2*1e6+10,mod);  return mf_arr[x];  }
// ll mod_nck(ll n, ll k, ll mod){ return m_f[n]*finv_arr[k]%mod*finv_arr[n-k]%mod; }
ll m_p(ll r,ll n,ll mod){  ll t=1,s=r;  while(n>0){ t = (n&1) ? t*s%mod : t;  s=s*s%mod; n>>=1; }  return r?t:0;  }
ll m_mul2(ll a, ll b, ll mod){ return a*b%mod; }
ll m_mul3(ll a, ll b, ll c, ll mod){ return m_mul2(a*b%mod,c,mod); }
ll m_mul4(ll a, ll b, ll c, ll d, ll mod){ return m_mul3(a*b%mod,c,d,mod); }
ll m_mul5(ll a, ll b, ll c, ll d, ll e, ll mod){ return m_mul4(a*b%mod,c,d,e,mod); }

int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
int cmp_string( const void * a , const void * b ) {  return strcmp( (char *)a , (char *)b ); }  // qsort((void*)s,n,sizeof(s[0]),int_sort );
int cmp_char(const void * a, const void * b) { return *(char *)a - *(char *)b;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
void sort_string(int n,int size,char s[][size]){ qsort( (void*)s , n , sizeof(s[0]) , cmp_string ); }
void sort_char(char *s){ qsort( (void *)s , strlen(s) , sizeof(char) , cmp_char ); }
ll unique_string(ll n ,ll size, char s[][size]){ ll ans=1; rep(i,1,n) if( strcmp(s[i],s[i-1]) ) ans++; return ans; }
ll unique_num(ll n , ll a[]){ ll ans=1; rep(i,1,n) if( a[i]!=a[i-1] ) ans++; return ans; }

typedef struct{ ll a , b;}fr;
int cmp1( const void *p, const void *q ) { return ((fr*)p) ->a - ((fr*)q)->a;}
int cmp2( const void *p, const void *q ) { return ((fr*)q) ->a - ((fr*)p)->a;}
void strsortup(fr*a,int n){qsort(a,n,sizeof(fr),cmp1);}
void strsortdown(fr*a,int n){qsort(a,n,sizeof(fr),cmp2);}

// char s[1151154];
ll b[200005];
int main(void){
    // fgets(s,sizeof(s),stdin);
    ll n;
    // ll ans=0;
    cin(&n);
    // scanf("%s",s);
    ll a[n];
    rep(i,0,n){
        cin(&a[i]);
    }
    rrep(i,n-1,0){
        ll p=0;
        repp(j,i,n,i+1){
            p+=b[j];
        }
        if(p%2!=a[i]){
            b[i]=1;
        }
    }
    ll m=0;
    rep(i,0,n){
        m+=b[i];
    }

    printf("%lld\n",m);
    rep(i,0,n){
        if(b[i]) printf("%lld ",b[i]);
    }
    PN;
    return 0;
}


#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;
}


#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;
	}
}


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")}]);


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));
  }
}


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"));


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')));


"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'));


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);
}


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), "[]"))
	}
}


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()
}


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()
}


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), "[]"))
	}
}


package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	an := make([]int, N+1)
	for i := 1; i <= N; i++ {
		an[i] = nextInt()
	}
	check := make([]int, N+1)
	ans := make([]int, 0)
	for i := N; i >= 1; i-- {
		var sum int
		if i*2 > N {

		}
		for j := i * 2; j <= N; j += i {
			sum += check[j]
		}
		if sum%2 != an[i] {
			ans = append(ans, i)
		}
	}
	sort.Ints(ans)
	fmt.Println(len(ans))
	fmt.Println(strings.Trim(fmt.Sprint(ans), "[]"))
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}

// ここから拝借
// https://shoman.hatenablog.com/entry/2020/02/25/185456
// Stackは[]intのエイリアス
type Stack []int

// Push adds an element
func (s *Stack) Push(v int) {
	*s = append(*s, v)
}

// Pop removes the top element and return it
func (s *Stack) Pop() (int, error) {
	if s.Empty() {
		return 0, fmt.Errorf("stack is empty")
	}

	v := (*s)[len(*s)-1]
	*s = (*s)[:len(*s)-1]
	return v, nil
}

// Peek returns the top value
func (s *Stack) Peek() (int, error) {
	if s.Empty() {
		return 0, fmt.Errorf("stack is empty")
	}

	return (*s)[len(*s)-1], nil
}

// Size returns the length of stack
func (s *Stack) Size() int {
	return len(*s)
}

// Empty returns true when stack is empty
func (s *Stack) Empty() bool {
	return s.Size() == 0
}

// NewStack generates stack
func NewStack() *Stack {
	s := new(Stack)
	return s
}

// golangの公式サンプルより
// https://xn--go-hh0g6u.com/pkg/container/heap/#example__intHeap
// IntHeap は，整数の最小ヒープです。
type IH []int

func (h IH) Len() int           { return len(h) }
func (h IH) Less(i, j int) bool { return h[i] < h[j] }
func (h IH) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IH) Push(x interface{}) {
	// Push と Pop はポインタレシーバを使っています。
	// なぜなら，スライスの中身だけでなく，スライスの長さも変更するからです。
	*h = append(*h, x.(int))
}

func (h *IH) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

// golangの公式サンプルより
// https://xn--go-hh0g6u.com/pkg/container/heap/#example__priorityQueue

// Item は，優先キューで管理する項目です。
type Item struct {
	value    string // 値。任意です。
	priority int    // キューにおける優先度
	// index は heap.Interface メソッドで更新されます。
	index int // ヒープにおけるインデックス
}

// PriorityQueue は heap.Interface を実装し，Item のリストを保持します。
type PriorityQueue []*Item

func (pq PriorityQueue) Len() int { return len(pq) }

func (pq PriorityQueue) Less(i, j int) bool {
	// Pop が最小ではなく最大の優先度を持つ項目を返して欲しいので，ここでは > を使っています。
	return pq[i].priority > pq[j].priority
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *PriorityQueue) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Item)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // メモリリークを避ける
	item.index = -1 // 安全のため
	*pq = old[0 : n-1]
	return item
}

// update はキューの Item の優先度と値を更新します。
func (pq *PriorityQueue) update(item *Item, value string, priority int) {
	item.value = value
	item.priority = priority
	heap.Fix(pq, item.index)
}


package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N := nextInt()
	an := make([]int, N)
	for i := range an {
		an[i] = nextInt()
	}
	// fmt.Println(an)
	// ans := make(map[int]int)
	check := make([]int, N+1)
	ans := make([]int, 0)
	// var cnt int
	for i := N - 1; i >= 0; i-- {
		var sum int
		for j := 2; j*(i+1) <= N; j++ {
			sum += check[j*(i+1)]
			// fmt.Println("sum", sum, j*i)
		}
		if sum%2 != an[i] {
			ans = append(ans, i+1)
			// cnt++
		}
		// fmt.Println("ans", ans)
	}
	// fmt.Println(strings.Trim(fmt.Sprint(ans), "[]"))
	fmt.Println(len(ans))
	fmt.Println(strings.Trim(fmt.Sprint(ans), "[]"))
	// for k := range ans {
	// 	fmt.Printf("%d ", k)
	// }
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}

// ここから拝借
// https://shoman.hatenablog.com/entry/2020/02/25/185456
// Stackは[]intのエイリアス
type Stack []int

// Push adds an element
func (s *Stack) Push(v int) {
	*s = append(*s, v)
}

// Pop removes the top element and return it
func (s *Stack) Pop() (int, error) {
	if s.Empty() {
		return 0, fmt.Errorf("stack is empty")
	}

	v := (*s)[len(*s)-1]
	*s = (*s)[:len(*s)-1]
	return v, nil
}

// Peek returns the top value
func (s *Stack) Peek() (int, error) {
	if s.Empty() {
		return 0, fmt.Errorf("stack is empty")
	}

	return (*s)[len(*s)-1], nil
}

// Size returns the length of stack
func (s *Stack) Size() int {
	return len(*s)
}

// Empty returns true when stack is empty
func (s *Stack) Empty() bool {
	return s.Size() == 0
}

// NewStack generates stack
func NewStack() *Stack {
	s := new(Stack)
	return s
}

// golangの公式サンプルより
// https://xn--go-hh0g6u.com/pkg/container/heap/#example__intHeap
// IntHeap は，整数の最小ヒープです。
type IH []int

func (h IH) Len() int           { return len(h) }
func (h IH) Less(i, j int) bool { return h[i] < h[j] }
func (h IH) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IH) Push(x interface{}) {
	// Push と Pop はポインタレシーバを使っています。
	// なぜなら，スライスの中身だけでなく，スライスの長さも変更するからです。
	*h = append(*h, x.(int))
}

func (h *IH) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

// golangの公式サンプルより
// https://xn--go-hh0g6u.com/pkg/container/heap/#example__priorityQueue

// Item は，優先キューで管理する項目です。
type Item struct {
	value    string // 値。任意です。
	priority int    // キューにおける優先度
	// index は heap.Interface メソッドで更新されます。
	index int // ヒープにおけるインデックス
}

// PriorityQueue は heap.Interface を実装し，Item のリストを保持します。
type PriorityQueue []*Item

func (pq PriorityQueue) Len() int { return len(pq) }

func (pq PriorityQueue) Less(i, j int) bool {
	// Pop が最小ではなく最大の優先度を持つ項目を返して欲しいので，ここでは > を使っています。
	return pq[i].priority > pq[j].priority
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *PriorityQueue) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Item)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // メモリリークを避ける
	item.index = -1 // 安全のため
	*pq = old[0 : n-1]
	return item
}

// update はキューの Item の優先度と値を更新します。
func (pq *PriorityQueue) update(item *Item, value string, priority int) {
	item.value = value
	item.priority = priority
	heap.Fix(pq, item.index)
}


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


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 * " "


#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)


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


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


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


use std::io::*;

// const SP: u8 = b' ';
const LF: u8 = b'\n';

struct CharacterInput<'a> {
    locked_stdin: StdinLock<'a>,
    bytes_buffer: Vec<u8>,
}

impl<'a> CharacterInput<'a> {
    fn read(&mut self, delimiter: u8) -> &[u8] {
        self.bytes_buffer.clear();

        let len = self
            .locked_stdin
            .read_until(delimiter, &mut self.bytes_buffer)
            .unwrap();

        let end_index = match self.bytes_buffer.last() {
            Some(byte) => {
                if *byte == delimiter {
                    len - 1
                } else {
                    len
                }
            }
            None => len,
        };

        &self.bytes_buffer[0..end_index]
    }

    fn scan_u(&mut self, delimiter: u8) -> u32 {
        self.read(delimiter)
            .into_iter()
            .fold(0, |accumulator, byte| {
                (byte - b'0') as u32 + accumulator * 10
            })
    }
}

fn create_cin<'a>(input: StdinLock<'a>, buffer_capacity: usize) -> CharacterInput {
    CharacterInput {
        locked_stdin: input,
        bytes_buffer: Vec::with_capacity(buffer_capacity),
    }
}

struct CharacterOutput {
    string_buffer: String,
}

impl CharacterOutput {
    fn push_s(&mut self, s: &str) {
        self.string_buffer += s;
    }

    fn push<T: ToString>(&mut self, n: T) {
        self.push_s(&n.to_string());
    }

    fn add<T: ToString>(&mut self, n: T, separator: char) {
        self.push(n);
        self.string_buffer.push(separator);
    }

    fn add_from_iterator<T: ToString, I>(
        &mut self,
        iterator: &mut I,
        length: usize,
        separator: char,
        delimiter: char,
    ) where
        I: Iterator<Item = T>,
    {
        for element in iterator.by_ref().take(length - 1) {
            self.add(element, separator);
        }
        self.add(iterator.next().unwrap(), delimiter);
    }

    fn flush(&mut self) {
        let out = stdout();
        let mut out = out.lock();
        out.write_all(self.string_buffer.as_bytes()).unwrap();
        self.string_buffer.clear();
    }
}

fn create_cout(capacity: usize) -> CharacterOutput {
    CharacterOutput {
        string_buffer: String::with_capacity(capacity),
    }
}

// ------------------------------------------------------------------------

fn main() {
    let cin = stdin();
    let cin = &mut create_cin(cin.lock(), 2 * 200000);

    let n = cin.scan_u(LF) as usize;
    let a_bytes = cin.read(LF);
    let mut k = 0;
    let a: Vec<bool> = (0..n)
        .map(|_| {
            let flag = a_bytes[k] == b'1';
            k += 2;
            flag
        })
        .collect();

    let mut ball: Vec<bool> = vec![false; n];
    let mut box_num_list = Vec::<usize>::with_capacity(n);

    for i in (0..n).rev() {
        let box_num = i + 1;

        let mut acc = ball[i];
        let mut k = i + box_num;
        while k < n {
            acc ^= ball[k];
            k += box_num;
        }

        if acc != a[i] {
            ball[i] = true;
            box_num_list.push(box_num);
        }
    }

    let box_len = box_num_list.len();
    let cout = &mut create_cout(7 * box_len);

    cout.add(box_len, '\n');

    if box_len > 0 {
        cout.add_from_iterator(&mut box_num_list.iter(), box_len, ' ', '\n');
    }

    cout.flush();
}


use std::io::*;

// const SP: u8 = b' ';
const LF: u8 = b'\n';

struct CharacterInput<'a> {
    locked_stdin: StdinLock<'a>,
    bytes_buffer: Vec<u8>,
}

impl<'a> CharacterInput<'a> {
    fn read(&mut self, delimiter: u8) -> &[u8] {
        self.bytes_buffer.clear();

        let len = self
            .locked_stdin
            .read_until(delimiter, &mut self.bytes_buffer)
            .unwrap();

        let end_index = match self.bytes_buffer.last() {
            Some(byte) => {
                if *byte == delimiter {
                    len - 1
                } else {
                    len
                }
            }
            None => len,
        };

        &self.bytes_buffer[0..end_index]
    }

    fn read_exact(&mut self, buffer: &mut Vec<u8>) {
        self.locked_stdin.read_exact(buffer).ok();
    }

    fn scan_u(&mut self, delimiter: u8) -> u32 {
        self.read(delimiter)
            .into_iter()
            .fold(0, |accumulator, byte| {
                (byte - b'0') as u32 + accumulator * 10
            })
    }
}

fn create_cin<'a>(input: StdinLock<'a>, buffer_capacity: usize) -> CharacterInput {
    CharacterInput {
        locked_stdin: input,
        bytes_buffer: Vec::with_capacity(buffer_capacity),
    }
}

struct CharacterOutput {
    string_buffer: String,
}

impl CharacterOutput {
    fn push_s(&mut self, s: &str) {
        self.string_buffer += s;
    }

    fn push<T: ToString>(&mut self, n: T) {
        self.push_s(&n.to_string());
    }

    fn add<T: ToString>(&mut self, n: T, separator: char) {
        self.push(n);
        self.string_buffer.push(separator);
    }

    fn add_from_iterator<T: ToString, I>(
        &mut self,
        iterator: &mut I,
        length: usize,
        separator: char,
        delimiter: char,
    ) where
        I: Iterator<Item = T>,
    {
        for element in iterator.by_ref().take(length - 1) {
            self.add(element, separator);
        }
        self.add(iterator.next().unwrap(), delimiter);
    }

    fn flush(&mut self) {
        let out = stdout();
        let mut out = out.lock();
        out.write_all(self.string_buffer.as_bytes()).unwrap();
        self.string_buffer.clear();
    }
}

fn create_cout(capacity: usize) -> CharacterOutput {
    CharacterOutput {
        string_buffer: String::with_capacity(capacity),
    }
}

// ------------------------------------------------------------------------

fn main() {
    let cin = stdin();
    let cin = &mut create_cin(cin.lock(), 2 * 200000);

    let n = cin.scan_u(LF) as usize;
    let mut a_bytes:Vec<u8> = vec!(0; 2 * n - 1);
    cin.read_exact(&mut a_bytes);
    let mut k = 0;
    let a: Vec<bool> = (0..n)
        .map(|_| {
            let flag = a_bytes[k] == b'1';
            k += 2;
            flag
        })
        .collect();

    let mut ball: Vec<bool> = vec![false; n];
    let mut box_num_list = Vec::<usize>::with_capacity(n);

    for i in (0..n).rev() {
        let box_num = i + 1;

        let mut acc = ball[i];
        let mut k = i + box_num;
        while k < n {
            acc ^= ball[k];
            k += box_num;
        }

        if acc != a[i] {
            ball[i] = true;
            box_num_list.push(box_num);
        }
    }

    let box_len = box_num_list.len();
    let cout = &mut create_cout(7 * box_len);

    cout.add(box_len, '\n');

    if box_len > 0 {
        cout.add_from_iterator(&mut box_num_list.iter(), box_len, ' ', '\n');
    }

    cout.flush();
}


use std::io::*;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

pub fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let n = i.read::<usize>();
    let a = i.read_vec::<u8>(n);
    if let Some(rs) = solve(&a) {
        let mut ans = Vec::new();
        for i in 0..a.len() {
            if rs[i] {
                ans.push(i);
            }
        }
        writeln!(o, "{}", ans.len()).unwrap();
        for i in 0..ans.len() {
            if i != 0 {
                write!(o, " ").unwrap();
            }
            write!(o, "{}", ans[i] + 1).unwrap();
        }
        writeln!(o, "").unwrap();
    } else {
        writeln!(o, "-1").unwrap();
    }
}
pub fn solve(a: &[u8]) -> Option<Vec<bool>> {
    let mut rs = vec![false; a.len()];
    for i0 in (0..a.len()).rev() {
        let s = i0 + 1;
        let mut i = i0 + s;
        let mut r = a[i0] != 0;
        while i < a.len() {
            r ^= rs[i];
            i += s;
        }
        rs[i0] = r;
    }
    Some(rs)
}

pub mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        b: Vec<u8>,
    }
    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                b: Vec::new(),
            }
        }
        pub fn read_word(&mut self) -> &[u8] {
            self.b.clear();
            let mut consume = 0;
            loop {
                self.r.consume(consume);
                let b = self.r.fill_buf().unwrap();
                assert!(b.len() != 0);
                if let Some(p) = b.iter().position(|&x| x == b' ' || x == b'\n') {
                    self.b.extend_from_slice(&b[..p]);
                    consume = p + 1;
                    break;
                }
                self.b.extend_from_slice(b);
                consume = b.len();
            }
            self.r.consume(consume);
            &self.b
        }
        pub fn read_word_str(&mut self) -> &str {
            unsafe { std::str::from_utf8_unchecked(self.read_word()) }
        }

        pub fn read_line(&mut self) -> &[u8] {
            self.b.clear();
            self.r.read_until(b'\n', &mut self.b).unwrap();
            if self.b.last() == Some(&b'\n') {
                &self.b[..self.b.len() - 1]
            } else {
                &self.b
            }
        }
        pub fn read_line_str(&mut self) -> &str {
            unsafe { std::str::from_utf8_unchecked(self.read_line()) }
        }

        pub fn read<T: CpIn>(&mut self) -> T {
            T::read_from(self)
        }

        pub fn read_vec<T: CpIn>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.read()).collect()
        }
        pub fn read_iter<'a, T: CpIn>(&'a mut self, n: usize) -> CpIter<'a, R, T> {
            CpIter {
                r: self,
                n: n,
                _pd: Default::default(),
            }
        }
    }
    pub struct CpIter<'a, R: BufRead + 'a, T> {
        r: &'a mut CpReader<R>,
        n: usize,
        _pd: std::marker::PhantomData<fn() -> T>,
    }
    impl<'a, R: BufRead, T: CpIn> Iterator for CpIter<'a, R, T> {
        type Item = T;
        fn next(&mut self) -> Option<T> {
            if self.n == 0 {
                None
            } else {
                self.n -= 1;
                Some(self.r.read())
            }
        }
    }

    pub trait CpIn {
        fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self;
    }

    impl CpIn for u64 {
        fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
            read_u64_fast(&mut r.r)
        }
    }
    impl CpIn for i64 {
        fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
            read_i64_fast(&mut r.r)
        }
    }
    impl CpIn for char {
        fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
            let b = r.r.fill_buf().unwrap()[0] as char;
            r.r.consume(1);
            let s = r.r.fill_buf().unwrap()[0];
            assert!(s == b' ' || s == b'\n');
            r.r.consume(1);
            b
        }
    }

    macro_rules! cpin_tuple {
        ($($t:ident),*) => {
            impl<$($t: CpIn),*> CpIn for ($($t),*) {
                fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
                    ($($t::read_from(r)),*)
                }
            }
        };
    }

    macro_rules! cpin_cast {
        ($t_self:ty, $t_read:ty) => {
            impl CpIn for $t_self {
                fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
                    <$t_read>::read_from(r) as $t_self
                }
            }
        };
    }
    macro_rules! cpin_parse {
        ($t:ty) => {
            impl CpIn for $t {
                fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
                    r.read_word_str().parse().unwrap()
                }
            }
        };
    }
    cpin_cast!(usize, u64);
    cpin_cast!(u32, u64);
    cpin_cast!(u16, u64);
    cpin_cast!(u8, u64);
    cpin_cast!(i32, i64);
    cpin_cast!(i16, i64);
    cpin_cast!(i8, i64);

    cpin_parse!(f64);

    cpin_tuple!(T1, T2);
    cpin_tuple!(T1, T2, T3);
    cpin_tuple!(T1, T2, T3, T4);
    cpin_tuple!(T1, T2, T3, T4, T5);

    fn read_u64_fast<R: BufRead>(r: &mut R) -> u64 {
        let mut value = 0;
        loop {
            let mut idx = 0;
            let buf_len;
            {
                let buf = r.fill_buf().unwrap();
                buf_len = buf.len();
                assert!(buf_len != 0);
                while idx < buf_len && b'0' <= buf[idx] && buf[idx] <= b'9' {
                    value = value * 10 + (buf[idx] - b'0') as u64;
                    idx += 1;
                }
            }
            if idx < buf_len {
                r.consume(idx + 1);
                return value;
            }
            r.consume(idx);
        }
    }
    fn read_i64_fast<R: BufRead>(r: &mut R) -> i64 {
        let (consume, sign) = match r.fill_buf().unwrap()[0] {
            b'+' => (true, 1),
            b'-' => (true, -1),
            _ => (false, 1),
        };
        if consume {
            r.consume(1);
        }
        read_u64_fast(r) as i64 * sign
    }

}


use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [u64; n],
    }

    let mut sum = vec![0; n + 1];
    for i in (1..=n).rev() {
        let mut j = i + i;
        let mut count = 0;
        while j <= n {
            count ^= sum[j];
            j += i;
        }
        sum[i] = count ^ a[i - 1];
    }

    let mut ans = Vec::new();
    for item in &sum {
        if *item == 1 {
            ans.push(*item);
        }
    }

    println!("{}", ans.len());
    for i in 0..ans.len() {
        print!("{}{}", ans[i], if i + 1 == ans.len() { "\n" } else { " " });
    }
}


use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }

    let mut sum = vec![0; n + 1];
    for i in (1..=n).rev() {
        let mut j = i + i;
        let mut count = 0;
        while j <= n {
            count ^= sum[j];
            j += i;
        }
        sum[i] = count ^ a[i - 1];
    }

    let mut ans = Vec::new();
    for item in &sum {
        if *item == 1 {
            ans.push(*item);
        }
    }

    println!("{}", ans.len());
    for i in 0..ans.len() {
        print!("{}{}", ans[i], if i + 1 == ans.len() { "\n" } else { " " });
    }
}


use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }

    let mut sum = vec![0; n + 1];
    for i in (1..=n).rev() {
        let mut j = i + i;
        let mut count = 0;
        while j <= n {
            count ^= sum[j];
            j += i;
        }
        sum[i] = count ^ a[i - 1];
    }

    let mut ans = Vec::new();
    for item in &sum {
        if *item == 1 {
            ans.push(*item);
        }
    }

    println!("{}", ans.len());
    for item in &ans {
        print!("{} ", item);
    }
    println!();
}


let n = Int(readLine()!)!

func solve(_ a: [Int]) -> [Int] {
  let n = a.count
  var ans: [Int] = .init(repeating: 0, count: n + 1)
  for i in (1...n).reversed() {
    var sum = 0
    var j = i + i
    while j <= n {
      sum ^= ans[j]
      j += i
    }
    ans[i] = sum ^ a[i]
  }
  return ans
}

var a: [Int] = .init(repeating: 0, count: n + 1)
let inputs = readLine()!
	.split(separator: " ")
	.map { Int($0)! }
	.enumerated()
	.forEach { a[$0+1] = $1 }

let ans = solve(a)
let res = ans.enumerated().filter { $1 == 1 }
print(res.count)
res.forEach { print($0.0) }


let n = Int(readLine()!)!

func solve(_ a: [Int]) -> [Int] {
  let n = a.count
  var ans: [Int] = .init(repeating: 0, count: n + 1)
  for i in (1...n).reversed() {
    var sum = 0
    var j = i + i
    while j <= n {
      sum ^= ans[j]
      j += i
    }
    ans[i] = sum ^ a[i]
  }
  return ans
}

var a: [Int] = .init(repeating: 0, count: n + 1)
let inputs = readLine()!
	.split(separator: " ")
	.map { Int($0)! }
	.enumerated()
	.forEach { a[$0+1] = $1 }

let ans = solve(a)
let res = ans.enumerated().filter { $1 == 1 }
print(res.count)
res.forEach { print($0) }


let n = Int(readLine()!)!

func solve(_ a: [Int]) -> [Int] {
  let n = a.count
  var ans: [Int] = .init(repeating: 0, count: n + 1)
  for i in (1...n).reversed() {
    var sum = 0
    var j = i + i
    while j <= n {
      sum ^= ans[j]
      j += i
    }
    ans[i] = sum ^ a[i]
  }
  return ans
}

var a: [Int] = .init(repeating: 0, count: n + 1)
let inputs = readLine()!
	.split(separator: " ")
	.map { Int($0)! }
	.enumerated()
	.forEach { a[$0+1] = $1 }

let ans = solve(a)

if ans.isEmpty {
  print(-1)
} else {
  let res = ans.enumerated().filter { $1 == 1 }
  print(res.count)
  res.forEach { print($0.0 + 1) }
}


let n = Int(readLine()!)!

func solve(_ a: [Int]) -> [Int] {
  let n = a.count
  var ans: [Int] = .init(repeating: 0, count: n + 1)
  for i in (1...n).reversed() {
    var sum = 0
    var j = i + i
    while j <= n {
      sum ^= j
      j += i
    }
    ans[i] = sum ^ a[i]
  }
  return ans
}

var a: [Int] = .init(repeating: 0, count: n + 1)
let inputs = readLine()!
	.split(separator: " ")
	.map { Int($0)! }
	.enumerated()
	.forEach { a[$0+1] = $1 }

let ans = solve(a)

if ans.isEmpty {
  print(-1)
} else {
  let res = ans.enumerated().filter { $1 == 1 }
  print(res.count)
  res.forEach { print($0.0 + 1) }
}


function main(input) {
  input = input.trim().split("\n");
  const n = Number(input[0]);
  const as = input[1].split(" ").map(n => Number(n));
  const result = Array(n).fill(0);
  let ans1 = 0;
  const ans2 = [];
  const mid = Math.floor(n/2);
  for (let i = n-1; 0 <= i; i--) {
    const a = as[i];
    if (mid <= i) {
      result[i] = a;
      if (a === 1) {
        ans1++;
        ans2.push(i+1);
      }
      continue;
    }
    const base = i + 1;
    let cnt = 0;
    let sum = 0;
    while(true) {
      cnt++;
      const index = base *(cnt + 1) - 1;
      if (n <= index) break;
      sum += result[index];
    }
    if (sum%2 === a) {
      result[i] = 0;
    } else {
      result[i] = 1;
      ans1++;
      ans2.push(i+1);
    }
  }
  console.log(ans1);
  if (ans1 !== 0) {
    console.log(ans2.join(" ");
  }
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const n = Number(stdin.split('\n')[0])

const a = stdin
  .split('\n')[1]
  .split(' ')
  .map(Number)

const ans = () => {
  const aLast = a.length - 1
  const halfLine = Math.ceil(n / 2)

  const b = []

  for (let i = 0; i < n; i++) {
    b[i] = 0
  }

  for (let i = 0; i < n; i++) {
    if (i < halfLine) {
      b[aLast - i] = a[aLast - i]
    } else {
      const num = aLast - i + 1

      let count = 0
      for (let j = 2; num * j <= n + 1; j++) {
        if (b[num * j - 1] === 1) count++
      }

      if (a[aLast - i] === 1) {
        b[aLast - i] = count % 2 === 1 ? 0 : 1
      } else {
        b[aLast - i] = count % 2 === 0 ? 0 : 1
      }
    }
  }

  const filtered = b.filter(e => e === 1)

  console.log(filtered.length)
  if (filtered.length === 0) return

  let str = ''
  for (let i = 0; i < n; i++) {
    if (b[i] === 1) {
      str += ` ${i + 1}`
    }
  }
  console.log(str.trim())
}

ans()


export class Main {
  static main(input): string {
    const tmp: string[] = input.split("\n");
    const n: number = parseInt(tmp[0]);
    const aList: number[] = tmp[1].split(" ").map(int => parseInt(int));
    const ballNumSet: Set<number> = new Set();
    const result: number[] = [];
    for (let i = n - 1; i >= 0; i--) {
      const num: number = i + 1;
      let isOne: boolean = aList[i] == 1;
      for (let j = 2, len = Math.min(n / num); j <= len; j++) {
        if (ballNumSet.has(num * j)) {
          isOne = !isOne;
        }
      }
      if (isOne) {
        ballNumSet.add(num);
        result.push(num);
      }
    }
    return `${result.length}\n${result.join(" ")}`;
  }
}
 console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const n = Number(stdin.split('\n')[0])

const a = stdin
  .split('\n')[1]
  .split(' ')
  .map(Number)

const ans = () => {
  const aLast = a.length - 1
  const halfLine = Math.ceil(n / 2)

  const b = []

  for (let i = 0; i < n; i++) {
    b[i] = 0
  }

  for (let i = 0; i < n; i++) {
    if (i < halfLine) {
      b[aLast - i] = a[aLast - i]
    } else {
      const num = aLast - i + 1

      let count = 0
      for (let j = 2; num * j <= n + 1; j++) {
        if (b[num * j - 1] === 1) count++
      }

      if (a[aLast - i] === 1) {
        b[aLast - i] = count % 2 === 1 ? 0 : 1
      } else {
        b[aLast - i] = count % 2 === 0 ? 0 : 1
      }
    }
  }

  const filtered = b.filter(e => e === 1)

  console.log(filtered.length)
  if (filtered.length === 0) return

  let str = `${filtered[0]}`

  for (let i = 1; i < filtered.length; i++) {
    str += ` ${filtered[i]}`
  }
  console.log(str)
}

ans()


const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const n = Number(stdin.split('\n')[0])

const a = stdin
  .split('\n')[1]
  .split(' ')
  .map(Number)

const ans = () => {
  const aLast = a.length - 1
  const halfLine = Math.ceil(n / 2)

  const b = []

  for (let i = 0; i < n; i++) {
    b[i] = 0
  }

  for (let i = 0; i < n; i++) {
    if (i < halfLine) {
      b[aLast - i] = a[aLast - i]
    } else {
      const num = aLast - i + 1

      let count = 0
      for (let j = 2; num * j <= n + 1; j++) {
        if (b[num * j - 1] === 1) count++
      }

      if (a[aLast - i] === 1) {
        b[aLast - i] = count % 2 === 1 ? 0 : 1
      } else {
        b[aLast - i] = count % 2 === 0 ? 0 : 1
      }
    }
  }

  console.log(b.length)
  let str = `${b[0]}`
  for (let i = 1; i < b.length; i++) {
    str += ` ${b[i]}`
  }
  console.log(str)
}

ans()


export class Main {
  static main(input): string {
    const tmp: string[] = input.split("\n");
    const n: number = parseInt(tmp[0].split(" ")[0]);
    const list: number[] = [];
    let max1: number = 0;
    let max2: number = 0;
    for (let i = 1; i <= n; i++) {
      const a: number = parseInt(tmp[i].split(" ")[0]);
      list.push(a);
      if (max1 < a) {
        if (max2 < max1) {
          max2 = max1;
        }
        max1 = a;
      } else if (max2 < a || max1 == a) {
        max2 = a;
      }
    }
    const isMaxDouble: boolean = max1 == max2;
    const result: number[] = [];
    for (let i = 0; i < n; i++) {
      if (!isMaxDouble && list[i] == max1) {
        result.push(max2);
      } else {
        result.push(max1);
      }
    }
    return `${result.join("\n")}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


a,b,c=map(int,input().split())
d=b-a
e=c-b
if d==e:
  print("YES")
else:
  print("NO")


# 入力　数字3つ
a, b, c = map(int, input().split())

# 柱の並び方が美しい場合 YES を、そうでない場合 NO を 1行に出力せよ。
if b-a == c-b :
    print("YES")
else :
    print("NO")


#! -*- coding:utf-8 -*-
import math
import sys
a,b,c = map(int,input().split())
x = b - a
y = c - b
if x == y:
    print('YES')
else:
    print('NO')


a,b,c=map(int, input().split())
print("Yes" if b-a==c-b else "No")


#!/usr/bin/env python3

def main():
    a, b, c = map(int, input().split())
    print("YES" if b - a == c - a else "NO")

if __name__ == "__main__":
    main()


a,b,c = map(int,input().split())
if b-a == c-a:
    print('YES')
else:
    print('NO')


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();
			String[] s = str.split(" ",0);
			int a = Integer.parseInt(s[0]);
			int b = Integer.parseInt(s[1]);
			int c = Integer.parseInt(s[2]);
			if(b - a == c - b) {
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}
//			long max  = 1000000007;
		}catch (Exception e) {
			System.exit(0);
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String[] inputstr = str.split(" ");
		int[] input = new int[3];
		for (int i = 0; i < 3; i++) {
			input[i] = Integer.parseInt(inputstr[i]);
		}
		if (input[1] == (input[0] + input[2]) / 2f)
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}


import java.io.*;
import java.util.*;

public class Main {
  private static void execute(ContestReader reader, PrintWriter out) {
    int a = reader.nextInt();
    int b = reader.nextInt();
    int c = reader.nextInt();
    if (2 * b == a + c) {
      out.println("YES");
    } else {
      out.println("NO");
    }
  }

  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;

  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }

  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  public int nextInt() {
    return Integer.parseInt(next());
  }

  public long nextLong() {
    return Long.parseLong(next());
  }

  public double nextDouble() {
    return Double.parseDouble(next());
  }

  public String[] nextArray(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }

  public int[] nextIntArray(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }

  public long[] nextLongArray(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }

  public double[] nextDoubleArray(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }

  public int[][] nextIntMatrix(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }

  public long[][] nextLongMatrix(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }

  public double[][] nextDoubleMatrix(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
}

class ModCalculator {
  private final long mod;

  ModCalculator(long mod) {
    this.mod = mod;
  }

  public long add(long a, long b) {
    return (a + b) % mod;
  }

  public long mul(long a, long b) {
    return (a * b) % mod;
  }

  public long pow(long a, long b) {
    if (b == 0) {
      return 1;
    }
    long v = pow(mul(a, a), b / 2);
    if (b % 2 == 1) {
      return mul(v, a);
    } else {
      return v;
    }
  }

  public long inverse(long a) {
    return pow(a, mod - 2);
  }

  public long div(long a, long b) {
    return mul(a, inverse(b));
  }
}

class ModCombinationCache {
  private final ModCalculator modCalculator;
  private final long[] factorialCache;
  private final long[] factorialInverseCache;

  public ModCombinationCache(int n, ModCalculator modCalculator) {
    this.modCalculator = modCalculator;
    factorialCache = new long[n];
    factorialCache[0] = 1;
    for (int i = 1; i < n; i++) {
      factorialCache[i] = modCalculator.mul(factorialCache[i-1], i);
    }

    factorialInverseCache = new long[n];
    for (int i = 0; i < n; i++) {
      factorialInverseCache[i] = modCalculator.inverse(factorialCache[i]);
    }
  }

  public long getFactorial(int n) {
    return factorialCache[n];
  }

  public long getCombination(int n, int k) {
    return modCalculator.mul(factorialCache[n], modCalculator.mul(factorialInverseCache[k], factorialInverseCache[n-k]));
  }
}

class Algorithm {
  private static void swap(Object[] list, int a, int b) {
    Object tmp = list[a];
    list[a] = list[b];
    list[b] = tmp;
  }

  public static <T extends Comparable<? super T>> boolean nextPermutation(T[] ts) {
    int rightMostAscendingOrderIndex = ts.length - 2;
    while (rightMostAscendingOrderIndex >= 0 &&
        ts[rightMostAscendingOrderIndex].compareTo(ts[rightMostAscendingOrderIndex + 1]) >= 0) {
      rightMostAscendingOrderIndex--;
    }
    if (rightMostAscendingOrderIndex < 0) {
      return false;
    }

    int rightMostGreatorIndex = ts.length - 1;
    while (ts[rightMostAscendingOrderIndex].compareTo(ts[rightMostGreatorIndex]) >= 0) {
      rightMostGreatorIndex--;
    }

    swap(ts, rightMostAscendingOrderIndex, rightMostGreatorIndex);
    for (int i = 0; i < (ts.length - rightMostAscendingOrderIndex - 1) / 2; i++) {
      swap(ts, rightMostAscendingOrderIndex + 1 + i, ts.length - 1 - i);
    }
    return true;
  }

  public static void shuffle(int[] array) {
    Random random = new Random();
    int n = array.length;
    for (int i = 0; i < n; i++) {
      int randomIndex = i + random.nextInt(n - i);

      int temp = array[i];
      array[i] = array[randomIndex];
      array[randomIndex] = temp;
    }
  }

  public static void shuffle(long[] array) {
    Random random = new Random();
    int n = array.length;
    for (int i = 0; i < n; i++) {
      int randomIndex = i + random.nextInt(n - i);

      long temp = array[i];
      array[i] = array[randomIndex];
      array[randomIndex] = temp;
    }
  }

  public static void sort(int[] array) {
    shuffle(array);
    Arrays.sort(array);
  }

  public static void sort(long[] array) {
    shuffle(array);
    Arrays.sort(array);
  }
}


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
        int a = sc.nextInt();
     	int b = sc.nextInt();
        int c = sc.nextInt();

        if(Math.abs(a - b) == Math.abs(b - c)){
          System.out.println("YES");
        }else{
          System.out.println("NO");
        }

    }
}


import java.math.BigInteger;
import java.util.*;
public class Main {

public static void main(String[] args)
{
	Scanner sc=new Scanner(System.in);
			int a=sc.nextInt();
			int b=sc.nextInt();
			int c=sc.nextInt();
			if(b==(a+c)/2) {
				System.out.println("YES");
			}else {
				System.out.println("NO");
			}
}
}

class pair{
	int x,y;
	pair(int x,int y){
		this.x=x;
		this.y=y;
	}
}


import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    if(b-a == c-b){
        System.out.println("Yes");
    }else{
        System.out.println("No");
    }
  }
}


#include<stdio.h>

int main(){
    int a,b,c;
    while(~scanf("%d%d%d",&a,&b,&c)){
        printf("%s\n",(b-a)==(c-b) ? "YES" : "NO");
    }
    return 0;
}


#include<cstdio>

int a, b, c;

int main(){
  scanf("%d %d %d", &a, &b, &c);

  if(b - a == c - b){
    printf("YES");
  }else{
    printf("NO");
  }

  return 0;

}


# include <stdio.h>
int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(b-a==c-b)printf("YES");
	else printf("NO");
	return 0;
}


#include <iostream>

int main () {
	int a,b,c;
  std::string res;

  if (c-b == b-a) {
  	res = "YES";
  } else {
  	res = "NO";
  }

  std::cout << res << std::endl;
}


#include <iostream>

int main () {
	int a,b,c;
  std::string res;

  if (c-b == b-a) {
  	res = "YES"
  } else {
  	res = "NO"
  }

  std::cout << res << std::endl;
}


#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>

#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>

using namespace std;

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(b - a = c - b) cout << "YES" << endl;
  else cout << "NO" << endl;
}


#include<stdio.h>

int main(void){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  if( b-a == c-b) puts("YES");
  else puts("NO");
  return 0;
}


#include <stdio.h>
int main(void){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(b-a==c-b)printf("YES\n");
	else printf("NO\n");
	return 0;
}


#include <stdio.h>

int main(){
	int a, b, c;

	scanf("%d %d %d", &a, &b, &c );
	if(b-a==c-b) printf("YES\n");
	else printf("NO\n");

	return 0;
}


#include<stdio.h>
int main(void){
	int a,b,c;
	if(b-a==c-b){
		printf("YES\n");
	}else{
		printf("NO\n");
	}
	return 0;
}


#include<stdio.h>
int main(void){
	int a,b,c;
	if(b-a==c-b){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}


#include <stdio.h>
int main()
{
    int a,b,c,x,y;
    scanf("%d %d %d", &a, &b, &c);

    x=b-a;

    y=c-b;

    if(x==y)
    {
        printf("yes");
    }
    else{
        printf("no");
    }
    return 0;
}


function Main (input) {
  input = input.split("\n")[0].split(" ").map(Number);
  var a = input[0], b = input[1], c = input[2];
  if (b - a == c - b) {
    console.log("YES");
  }
  else {
    console.log("NO");
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {
	var A = parseInt(input.split(" ")[0]);
  var B = parseInt(input.split(" ")[1]);
  var C = parseInt(input.split(" ")[2]);
  if(B - A == C - B){
     console.log("YES");
     }else{
      console.log("NO");
     }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input){
    input=input.split("\n");
    tmp=input[0].split(" ");
    var a = parseInt(tmp[0], 10);
    var b = parseInt(tmp[1], 10);
    var c = parseInt(tmp[2], 10);
    if(b-a == c-b){
	console.log("YES");
    }else{
	console.log("NO");
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function main(input) {
  input = input.trim();
  const [a,b,c] = input.split(" ").map(Number);
  let A = b-a;
  let B = c-a;
  if(A==B){
    console.log("YES");
  }else{
    console.log("NO");
  }
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main (input) {
  input = inpur.split("\n")[0].split(" ").map(Number);
  var a = input[0], b = input[1], c = input[2];
  if (b - a == c - b) {
    console.log("YES");
  }
  else {
    console.log("NO");
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {
  input = input.trim()
  input = input.split(" ").map(Number);
if(input[1]-input[0]==input[2]-input[1]){
  console.log("YES");
}else{
  console.log("NO");
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"reflect"
	"sort"
	"strconv"
	"strings"
	// "regexp"
)

/* sort */
type pair struct {
	index  int64
	p1, p2 interface{}
}
type pairs []pair

func (slice pairs) Len() int {
	return len(slice)
}

func (slice pairs) Less(i, j int) bool {
	return slice[i].index < slice[j].index
}

func (slice pairs) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}

/* sort */
type Int64Slice []int64

func (slice Int64Slice) Len() int {
	return len(slice)
}

func (slice Int64Slice) Less(i, j int) bool {
	return slice[i] < slice[j]
}

func (slice Int64Slice) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}
func Int64s(a []int64)                    { sort.Sort(Int64Slice(a)) }
func Int64sSliceAreSorted(a []int64) bool { return sort.IsSorted(Int64Slice(a)) }

const (
	initialBufSize = 1e4
	maxBufSize     = 1e8
	INF            = 1e8
)

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriter(os.Stdout)
	di      = []int64{-1, 0, 1, 0}
	dj      = []int64{0, -1, 0, 1}
)

func main() {
	buf := make([]byte, initialBufSize)
	scanner.Buffer(buf, maxBufSize)
	scanner.Split(bufio.ScanWords)
	a, b, c := readInt(), readInt(), readInt()
	if b-a == c-b {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

/*==========================================
 *             Library
 *==========================================*/
func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}
func doubleAry(h int64, w int64, init int64) (res [][]int64) {
	res = make([][]int64, h)
	for i := int64(0); i < h; i++ {
		res[i] = make([]int64, w)
		for j := int64(0); j < w; j++ {
			res[i][j] = init
		}
	}
	return
}

func aryEq(a []int64, b []int64) bool {
	return reflect.DeepEqual(a, b)
}

func clone(n []int64) (r []int64) {
	r = make([]int64, len(n))
	for i := 0; i < len(n); i++ {
		r[i] = n[i]
	}
	return
}
func write(s string) {
	writer.WriteString(s)
}

func print() {
	writer.Flush()
}

// scanner.Split(bufio.ScanWords) をコメントアウトしないと使用不可
func readLine() (s string) {
	if scanner.Scan() {
		s = scanner.Text()
	}
	return s
}

func readInt() (read int64) {
	scanner.Scan()
	read, err := strconv.ParseInt(scanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return
}

func readFloat() (read float64) {
	scanner.Scan()
	read, err := strconv.ParseFloat(scanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return
}

func readRunes() (read []rune) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, v)
	}
	return
}

func readString() (read string) {
	scanner.Scan()
	read = scanner.Text()
	return
}

func readStrings() (read []string) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, string(v))
	}
	return
}

func s2i(s string) int64 {
	var intVal, e = strconv.ParseInt(s, 10, 64)
	if e != nil {
		panic(e)
	}
	return intVal
}

func i2s(i int64) string {
	var strVal = strconv.FormatInt(i, 10)
	return strVal
}

func s2f(s string) float64 {
	var floatVal, e = strconv.ParseFloat(s, 64)
	if e != nil {
		panic(e)
	}
	return floatVal
}

func abs(i int64) int64 {
	return int64(math.Abs(float64(i)))
}

func max(a ...int64) int64 {
	ans := int64(0)
	for i, v := range a {
		if i == 0 {
			ans = v
		}
		if ans < v {
			ans = v
		}
	}
	return ans
}
func min(a ...int64) int64 {
	ans := int64(0)
	for i, v := range a {
		if i == 0 {
			ans = v
		}
		if ans > v {
			ans = v
		}
	}
	return ans
}

func sum(i []int64) int64 {
	sum := int64(0)
	for _, val := range i {
		sum += val
	}
	return sum
}

func split(s string) []string {
	return strings.Fields(s)
}

func strAry2intAry(strs []string) []int64 {
	var ret = make([]int64, 0, len(strs))
	for _, str := range strs {
		var intVal = s2i(str)
		ret = append(ret, intVal)
	}
	return ret
}

func intAry2strAry(nums []int64) []string {
	var ret = make([]string, 0, len(nums))
	for _, num := range nums {
		var strVal = i2s(num)
		ret = append(ret, strVal)
	}
	return ret
}

func ary2str(strs []string) string {
	return strings.Join(strs, " ")
}

func reverse(res []int64) []int64 {
	for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
		res[i], res[j] = res[j], res[i]
	}
	return res
}
func reverseStr(res []string) []string {
	for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
		res[i], res[j] = res[j], res[i]
	}
	return res
}

func ini(res []int, init int) {
	if len(res) == 0 {
		return
	}
	res[0] = init
	for i := 0; i < len(res); i++ {
		copy(res[i:], res[:i])
	}
}

//
// func regexpExample() {
//     // Your code here!
//     var str = "13:20"
//     r := regexp.MustCompile(`(\d+):(\d+)`)
//     fmt.Println(r.FindStringSubmatch(str))
// }

// type Country struct {
//     gold int
//     silver int
//     blonze int
// }

// // 複数ソートのサンプル
// func stableSortExample() []Country{
//     var country = []Country {
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:3, blonze:2},
//         {gold:1, silver:3, blonze:3},
//     }
//     sort.SliceStable(country, func(i, j int) bool { return country[i].blonze > country[j].blonze })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].silver > country[j].silver })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].gold > country[j].gold })
//     return country
// }


package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	a := make([]int, 3)
	con.Scan(&a[0], &a[1], &a[2])
	sort.Ints(a)
	if a[1]-a[0] == a[2]-a[1] {
		con.Println("YES")
	} else {
		con.Println("NO")
	}
	return nil
}


package main

import (
  "fmt"
)

func main() {
  var a, b, c int; fmt.Scan(&a, &b, &c)
  ans := "NO"
  if b - a == c - b {ans = "YES"}
  fmt.Println(ans)
}