Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
al=list(map(int,input().split()))
ans=[]
tl=[0]*n
for i in range(n,0,-1):
    if tl[i-1]%2^al[i-1]:
        ans.append(i)
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                tl[j-1]^=1
                if j**2==i:
                    continue
                tl[i//j-1]^=1
print(len(ans))
print(*ans)

Fixed submission:
n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
tl=[0]*n
for i in range(n,0,-1):
    if tl[i-1]%2!=al[i-1]:
        ac+=1
        ans.add(i)
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                tl[j-1]+=1
                if j**2==i:
                    continue
                tl[i//j-1]+=1
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
tl=[0]*n
for i in range(n,0,-1):
    if tl[i-1]%2!=al[i-1]:
        ac+=1
        ans.add(i)
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                tl[j-1]+=1
                if j**2==i:
                    continue
                tl[i//j-1]+=1
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))

Fixed submission:
n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
tl=[0]*n
for i in range(n,0,-1):
    if tl[i-1]%2!=al[i-1]:
        ac+=1
        ans.add(i)
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                tl[j-1]+=1
                if j**2==i:
                    continue
                tl[i//j-1]+=1
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
tl=[0]*n
for i in range(n,0,-1):
    if tl[i-1]%2!=al[i-1]:
        ac+=1
        ans.add(i)
        for j in range(1,i+1):
            if i%j==0:
                tl[j-1]+=1
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))

Fixed submission:
n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
tl=[0]*n
for i in range(n,0,-1):
    if tl[i-1]%2!=al[i-1]:
        ac+=1
        ans.add(i)
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                tl[j-1]+=1
                if j**2==i:
                    continue
                tl[i//j-1]+=1
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
tl=[0]*n
for i in range(n,0,-1):
    if tl[i-1]%2!=al[i-1]:
        ac+=1
        ans.add(i)
        for j in range(1,i+1):
            if i%j==0:
                tl[j-1]+=1
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))

Fixed submission:
n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
tl=[0]*n
for i in range(n,0,-1):
    if tl[i-1]%2!=al[i-1]:
        ac+=1
        ans.add(i)
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                tl[j-1]+=1
                if j**2==i:
                    continue
                tl[i//j-1]+=1
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
for i in range(n,0,-1):
    t=sum([1 for a in ans if a%i==0])
    if t%2!=al[i-1]:
        ac+=1
        ans.add(i)
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))

Fixed submission:
n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
tl=[0]*n
for i in range(n,0,-1):
    if tl[i-1]%2!=al[i-1]:
        ac+=1
        ans.add(i)
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                tl[j-1]+=1
                if j**2==i:
                    continue
                tl[i//j-1]+=1
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
for i in range(n,0,-1):
    t=0
    for j in ans:
        if j%i==0:
            t+=1
    if t%2!=al[i-1]:
        ac+=1
        ans.add(i)
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))

Fixed submission:
n=int(input())
al=list(map(int,input().split()))
ac=0
ans=set()
tl=[0]*n
for i in range(n,0,-1):
    if tl[i-1]%2!=al[i-1]:
        ac+=1
        ans.add(i)
        for j in range(1,int(i**0.5)+1):
            if i%j==0:
                tl[j-1]+=1
                if j**2==i:
                    continue
                tl[i//j-1]+=1
print(ac)
if ac>0:
    print(' '.join(map(str,ans)))