Buggy python submission (verdict: Runtime Error):
N = int(input("N = "))
a = []
ball = []
while N != len(a):
    a.append(int(input("a_i = ")))
    ball.append(0)
i = N
ballcount = 0
check = 2
out = 0
while i != 0 and out != N + 1:
    while check * i <= N: 
        ballcount += ball[check * i - 1]
        check += 1
    if ballcount % 2 != a[i - 1]:
        ball[i - 1] = 1
    check = 2
    i -= 1
    ballcount = 0
    out += 1
if out == N + 1:
    i = out
    print(-1)
M = 0
while i < N:
    if ball[i] == 1:
        M += 1
    i += 1
print(M)
i = 0
while i < N:
    if ball[i] == 1:
        print(i + 1)
    i += 1

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ball = [0 for c in range(N)]
i = N
ballcount = 0
check = 2
out = 0
while i != 0 and out != N + 1:
    while check * i <= N: 
        ballcount += ball[check * i - 1]
        check += 1
    if ballcount % 2 != a[i - 1]:
        ball[i - 1] = 1
    check = 2
    i -= 1
    ballcount = 0
    out += 1
if out == N + 1:
    i = out
    print(-1)
M = 0
while i < N:
    if ball[i] == 1:
        M += 1
    i += 1
print(M)
i = 0
while i < N:
    if ball[i] == 1:
        print(i + 1)
    i += 1

Buggy python submission (verdict: Runtime Error):
N = int(input("N = "))
a = []
ball = []
while N != len(a):
    a.append(int(input("a_i = ")))
    ball.append(0)
i = N
ballcount = 0
check = 2
out = 0
while i != 0 and out != N + 1:
    while check * i <= N: 
        ballcount += ball[check * i - 1]
        check += 1
    if ballcount % 2 != a[i - 1]:
        ball[i - 1] = 1
    check = 2
    i -= 1
    ballcount = 0
    out += 1
if out == N + 1:
    i = out
    print(-1)
M = 0
while i < N:
    if ball[i] == 1:
        M += 1
    i += 1
print(M)
i = 0
while i < N:
    if ball[i] == 1:
        print(i + 1,end=" ")
    i += 1

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ball = [0 for c in range(N)]
i = N
ballcount = 0
check = 2
out = 0
while i != 0 and out != N + 1:
    while check * i <= N: 
        ballcount += ball[check * i - 1]
        check += 1
    if ballcount % 2 != a[i - 1]:
        ball[i - 1] = 1
    check = 2
    i -= 1
    ballcount = 0
    out += 1
if out == N + 1:
    i = out
    print(-1)
M = 0
while i < N:
    if ball[i] == 1:
        M += 1
    i += 1
print(M)
i = 0
while i < N:
    if ball[i] == 1:
        print(i + 1)
    i += 1

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = []
ball = []
while N != len(a):
    a.append(int(input()))
    ball.append(0)
i = N
ballcount = 0
check = 2
out = 0
while i != 0 and out != N + 1:
    while check * i <= N: 
        ballcount += ball[check * i - 1]
        check += 1
    if ballcount % 2 != a[i - 1]:
        ball[i - 1] = 1
    check = 2
    i -= 1
    ballcount = 0
    out += 1
if out == N + 1:
    i = out
    print(-1)
M = 0
while i < N:
    if ball[i] == 1:
        M += 1
    i += 1
print(M)
i = 0
while i < N:
    if ball[i] == 1:
        print(i + 1)
    i += 1

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ball = [0 for c in range(N)]
i = N
ballcount = 0
check = 2
out = 0
while i != 0 and out != N + 1:
    while check * i <= N: 
        ballcount += ball[check * i - 1]
        check += 1
    if ballcount % 2 != a[i - 1]:
        ball[i - 1] = 1
    check = 2
    i -= 1
    ballcount = 0
    out += 1
if out == N + 1:
    i = out
    print(-1)
M = 0
while i < N:
    if ball[i] == 1:
        M += 1
    i += 1
print(M)
i = 0
while i < N:
    if ball[i] == 1:
        print(i + 1)
    i += 1

Buggy python submission (verdict: Runtime Error):
N = int(input("N = "))
a = []
ball = []
while N != len(a):
    a.append(int(input("a_i = ")))
    ball.append(0)
i = N
ballcount = 0
check = 2
out = 0
while i != 0 and out != N + 1:
    while check * i <= N: 
        ballcount += ball[check * i - 1]
        check += 1
    if ballcount % 2 != a[i - 1]:
        ball[i - 1] = 1
    check = 2
    i -= 1
    ballcount = 0
    out += 1
if out == N + 1:
    i = out
    print(-1)
M = 0
while i < N:
    if ball[i] == 1:
        M += 1
    i += 1
print(M)
i = 0
while i < N:
    if ball[i] == 1:
        print(i + 1)
    i += 1

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ball = [0 for c in range(N)]
i = N
ballcount = 0
check = 2
out = 0
while i != 0 and out != N + 1:
    while check * i <= N: 
        ballcount += ball[check * i - 1]
        check += 1
    if ballcount % 2 != a[i - 1]:
        ball[i - 1] = 1
    check = 2
    i -= 1
    ballcount = 0
    out += 1
if out == N + 1:
    i = out
    print(-1)
M = 0
while i < N:
    if ball[i] == 1:
        M += 1
    i += 1
print(M)
i = 0
while i < N:
    if ball[i] == 1:
        print(i + 1)
    i += 1