Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.

There are n toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned over, both cars turned over. A car is good if it turned over in no collision. The results of the collisions are determined by an n × n matrix А: there is a number on the intersection of the і-th row and j-th column that describes the result of the collision of the і-th and the j-th car:    - 1: if this pair of cars never collided.  - 1 occurs only on the main diagonal of the matrix.  0: if no car turned over during the collision.  1: if only the i-th car turned over during the collision.  2: if only the j-th car turned over during the collision.  3: if both cars turned over during the collision. 

Susie wants to find all the good cars. She quickly determined which cars are good. Can you cope with the task?


-----Input-----

The first line contains integer n (1 ≤ n ≤ 100) — the number of cars.

Each of the next n lines contains n space-separated integers that determine matrix A. 

It is guaranteed that on the main diagonal there are  - 1, and  - 1 doesn't appear anywhere else in the matrix.

It is guaranteed that the input is correct, that is, if A_{ij} = 1, then A_{ji} = 2, if A_{ij} = 3, then A_{ji} = 3, and if A_{ij} = 0, then A_{ji} = 0.


-----Output-----

Print the number of good cars and in the next line print their space-separated indices in the increasing order.


-----Examples-----
Input
3
-1 0 0
0 -1 1
0 2 -1

Output
2
1 3 
Input
4
-1 3 3 3
3 -1 3 3
3 3 -1 3
3 3 3 -1

Output
0

Difficulty: EASY

Solutions:
import sys
n = int(input())
scores = [True for x in range(n)]
for i in range(n):
	line = input().split(' ')
	for j in range(len(line)):
		e = line[j]
		if e == '-1':
			continue
		elif e == '0':
			continue
		elif e == '1':
			scores[i] = False
		elif e == '2':
			scores[j] = False
		elif e == '3':
			scores[i] = False
			scores[j] = False
total = 0
for car in scores:
	if car:
		total += 1
print(total)
for (i, car) in enumerate(scores):
	if car:
		print(i + 1, end=' ')
print()


def ToyCars(n, arr):
	badCar = [0] * n
	i = 0
	while i < n:
		j = i + 1
		seq = [int(x) for x in arr[i].split()]
		while j < n:
			if seq[j] == 1:
				badCar[i] = 1
			elif seq[j] == 2:
				badCar[j] = 1
			elif seq[j] == 3:
				badCar[j] = 1
				badCar[i] = 1
			j += 1
		i += 1
	i = 0
	totalCnt = 0
	result = ''
	while i < n:
		if badCar[i] == 0:
			totalCnt += 1
			result += str(i + 1)
			result += ' '
		i += 1
	return (totalCnt, result[:len(result) - 1])
n = int(input())
i = 0
arr = []
while i < n:
	arr.append(input())
	i += 1
(totalCnt, result) = ToyCars(n, arr)
print(totalCnt)
if result != '':
	print(result)


a = 0
x = 1
lst = []
for i in range(int(input())):
	z = list(map(int, input().split()))
	if 1 not in z and 3 not in z:
		a += 1
		lst.append(x)
	x += 1
print(a)
print(*lst)


n = int(input())
ans = []
for i in range(1, n + 1):
	a = [int(x) % 2 for x in input().split(' ') if int(x) >= 0]
	if sum(a) == 0:
		ans.append(i)
print(len(ans))
print(*ans)


n = int(input())
l = []
for i in range(n):
	l1 = input().split()
	l.append(l1)
p = 0
r = []
for i in range(n):
	s = 0
	k = 0
	for j in range(n):
		if i != j:
			if l[i][j] == '0' or l[i][j] == '2':
				s += 1
			else:
				k = 1
				break
	if k == 0 and s == n - 1:
		p += 1
		r.append(i + 1)
print(p)
r1 = len(r)
for i in range(r1):
	print(r[i], '', end='')


a = int(input())
c = []
d = []
for i in range(a):
	b = list(map(int, input().split()))
	c.append(b)
for i in range(len(c)):
	b = 0
	for k in range(len(c)):
		if c[i][k] == 1 or c[i][k] == 3:
			b += 1
	if b == 0:
		d.append(i)
print(len(d))
for i in range(len(d)):
	print(d[i] + 1, end=' ')


n = int(input())
res = []
for i in range(n):
	arr = list(map(int, input().split()))
	if not (1 in arr or 3 in arr):
		res.append(i + 1)
print(len(res))
print(*res)


z = []
n = int(input())
j = [input().split() for _ in range(n)]
h = [[int(g) for g in i] for i in j]
for i in range(len(h)):
	if 3 not in h[i] and 1 not in h[i]:
		z.append(i + 1)
if len(z) > 0:
	print(len(z))
	print(*z)
else:
	print(0)


n = int(input())
a = [[0 for i in range(n)] for j in range(n)]
good = [0] * (n + 1)
cnt = 0
for i in range(n):
	a[i] = list(map(int, input().split()))
for i in range(n):
	for j in range(n):
		if a[i][j] == 0 or a[i][j] == -1 or a[i][j] == 2:
			cnt += 1
	if cnt == n:
		good[i] = 1
	cnt = 0
cnt = 0
for j in range(n):
	for i in range(n):
		if a[i][j] == 0 or a[i][j] == -1 or a[i][j] == 1:
			cnt += 1
	if cnt != n:
		good[j] = 0
	cnt = 0
print(sum(good))
for i in range(n):
	if good[i] == 1:
		print(i + 1, end=' ')


l = []
for i in range(int(input())):
	l2 = list(map(int, input().split()))
	if l2.count(1) == 0 and l2.count(3) == 0:
		l.append(i + 1)
l.sort()
print(len(l))
print(*l)


n = int(input())
res = []
for i in range(n):
	for x in map(int, input().split()):
		if x == 1 or x == 3:
			break
	else:
		res.append(i + 1)
print(len(res))
print(' '.join(map(str, res)))


class CodeforcesTask545ASolution:

	def __init__(self):
		self.result = ''
		self.cars_count = 0
		self.test_results = []

	def read_input(self):
		self.cars_count = int(input())
		for x in range(self.cars_count):
			self.test_results.append([int(x) for x in input().split(' ')])

	def process_task(self):
		good = []
		for x in range(self.cars_count):
			if 1 not in self.test_results[x] and 3 not in self.test_results[x]:
				good.append(x + 1)
		self.result = '{0}\n{1}'.format(len(good), ' '.join([str(x) for x in good]))

	def get_result(self):
		return self.result
Solution = CodeforcesTask545ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


I = lambda : map(int, input().split())
n = int(input())
res = [True] * n
for i in range(n):
	a = list(I())
	if res[i]:
		for j in range(n):
			if a[j] == 1:
				res[i] = False
			elif a[j] == 2:
				res[j] = False
			elif a[j] == 3:
				(res[i], res[j]) = (False, False)
ans = list()
Len = 0
for i in range(n):
	if res[i]:
		ans.append(i + 1)
		Len += 1
print(Len)
if Len != 0:
	print(*ans)
print(exit())


x = int(input())
l = []
con = []
good = 0
for i in range(x):
	t = list(map(int, input().split()))
	l.append(t)
for i in range(x):
	r = l[i].count(1)
	r1 = l[i].count(3)
	flag = 0
	for j in range(x):
		if l[j][i] == '2' and l[j][i] == '3':
			flag = 1
			break
	if r == 0 and r1 == 0 and (flag == 0):
		good = good + 1
		con.append(i + 1)
print(good)
print(*con)


n = int(input())
matrix = []
for i in range(n):
	matrix.append(list(input().split()))
ans = []
for i in range(n):
	if all((j not in {'1', '3'} for j in matrix[i])):
		ans.append(i + 1)
print(len(ans))
print(' '.join(map(str, ans)))


n = int(input())
good = []
for i in range(n):
	for (j, x) in enumerate(map(int, input().split())):
		if j != i and x in (1, 3):
			break
	else:
		good.append(i + 1)
print(len(good))
if good:
	print(' '.join(map(str, good)))


n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
a2 = [0] * n
for y in range(n):
	for x in range(n):
		if a[y][x] != -1:
			if a[y][x] == 1:
				a2[y] = 1
			elif a[y][x] == 2:
				a2[x] = 1
			elif a[y][x] == 3:
				a2[x] = 1
				a2[y] = 1
num = 0
for i in range(n):
	if a2[i] == 0:
		num += 1
print(num)
for i in range(n):
	if a2[i] == 0:
		print(i + 1, end=' ')


(n, a) = (int(input()), [])
for i in range(n):
	x = list(map(int, input().split(' ')))
	if 1 not in x and 3 not in x:
		a.append(i + 1)
print(len(a))
print(*sorted(a))


import sys
r = lambda : list(map(int, input().split()))
n = int(input())
a = []
for i in range(n):
	a.append(list(r()))
goods = list(range(n))
for i in range(n):
	for j in range(n):
		if i == j or a[i][j] == 0 or a[i][j] == -1:
			continue
		if a[i][j] == 1 and i in goods:
			goods.remove(i)
		if a[i][j] == 2 and j in goods:
			goods.remove(j)
		if a[i][j] == 3:
			if i in goods:
				goods.remove(i)
			if j in goods:
				goods.remove(j)
print(len(goods))
print(' '.join([str(goods[i] + 1) for i in range(len(goods))]))


a = int(input(''))
answerList = []
inp = [[0 for x in range(int(a))] for x in range(int(a))]
for value in range(a):
	x = input('').split(' ')
	for val in range(a):
		inp[value][val] = x[val]

def check(bad, toed):
	ok1 = True
	ok2 = True
	for value in range(a):
		if bad[toed][value] == '1' or bad[toed][value] == '3':
			ok1 = False
	for value in range(a):
		if bad[value][toed] == '2' or bad[value][toed] == '3':
			ok2 = False
	if ok1 == True and ok2 == True:
		return True
	else:
		return False
for value in range(a):
	if check(inp, value) == True:
		answerList.append(value + 1)
stringOfDoom = ''
for value in answerList:
	stringOfDoom = stringOfDoom + str(value) + ' '
print(len(answerList))
print(stringOfDoom[0:len(stringOfDoom) - 1])


num = int(input())
car_list = []
for i in range(num):
	car_list.append(input().split())
good_car = []
for i in range(num):
	count = 0
	for j in range(num):
		if car_list[i][j] == '1' or car_list[i][j] == '3':
			count += 1
	if count == 0:
		good_car.append(i + 1)
print(len(good_car))
if len(good_car) != 0:
	for i in range(len(good_car)):
		print(good_car[i], end=' ')


n = int(input())
A = []
for i in range(n):
	A.append([int(j) for j in input().split()])
m = 0
ans = []
for i in range(n):
	flag = 0
	for j in range(n):
		if A[i][j] == 1 or A[i][j] == 3:
			flag = 1
			break
	if flag == 0:
		m += 1
		ans.append(i + 1)
print(m)
for i in ans:
	print(i, end=' ')
if ans != []:
	print()


n = int(input())
cnt = 0
ans = []
for i in range(n):
	a = list(map(int, input().split()))
	if not (1 in a or 3 in a):
		cnt += 1
		ans.append(i + 1)
print(cnt)
if cnt > 0:
	print(*ans)


n = int(input())
arr = []
for i in range(n):
	arr.append([])
	arr[i] = [int(z) for z in input().split()]
c = 0
l = []
for i in range(n):
	flag = 0
	for j in range(n):
		if i != j:
			if arr[i][j] == 1 or arr[i][j] == 3:
				flag = 1
	if flag == 0:
		c = c + 1
		l.append(i + 1)
print(c)
print(*l)


def judge(a):
	for i in a:
		if i == '1' or i == '3':
			return 0
	return 1
n = int(input())
ans = []
for i in range(1, n + 1):
	s = input()
	a = s.split()
	if judge(a):
		ans.append(i)
t = len(ans)
print(t)
for i in range(0, t):
	if i != t - 1:
		print(ans[i], end=' ')
	else:
		print(ans[i])


n = int(input())
c = []
for i in range(n):
	g = [int(x) for x in input().split()]
	e = 0
	for j in g:
		if j == 1 or j == 3:
			e += 1
	if e == 0:
		c.append(i + 1)
if len(c) == 0:
	print(0)
else:
	print(len(c))
	print(*c)


n = int(input())
a = [[int(x) for x in input().split()] for i in range(n)]
b = [x for x in range(n) if all((max(0, y) & 1 == 0 for y in a[x]))]
print(len(b))
print(' '.join([str(y + 1) for y in b]))


n = int(input())
input()
g = [0] * n
for r in range(2, n + 1):
	c = list(map(int, input().split()))[:r - 1]
	for i in range(r - 1):
		if c[i] == 1:
			g[r - 1] += 1
		elif c[i] == 2:
			g[i] += 1
		elif c[i] == 3:
			g[r - 1] += 1
			g[i] += 1
print(g.count(0))
for i in [x + 1 for (x, y) in enumerate(g) if y == 0]:
	print(i, end=' ')


n = int(input())
A = []
for i in range(n):
	row = list(map(int, input().strip().split()))
	A.append(row)
arr = [True for i in range(n)]
for i in range(n - 1):
	for j in range(i + 1, n):
		if A[i][j] == 1:
			arr[i] = False
		elif A[i][j] == 2:
			arr[j] = False
		elif A[i][j] == 3:
			arr[i] = False
			arr[j] = False
l = []
for i in range(n):
	if arr[i]:
		l.append(i + 1)
print(len(l))
print(*l)


import os
import sys
from sys import stdin, stdout
from io import BytesIO, IOBase
mod = int(1000000000.0) + 7
intn = lambda : int(stdin.readline())
strs = lambda : stdin.readline()[:-1]
lstr = lambda : list(stdin.readline()[:-1])
mint = lambda : map(int, stdin.readline().split())
lint = lambda : list(map(int, stdin.readline().split()))
out = lambda x: stdout.write(str(x) + '\n')
out_ = lambda x: stdout.write(str(x) + ' ')

def main():
	n = intn()
	c = [0 for _ in range(n)]
	for i in range(n):
		a = lint()
		for j in range(i):
			if a[j] == 3:
				c[i] = c[j] = 1
			elif a[j] == 2:
				c[j] = 1
			elif a[j] == 1:
				c[i] = 1
	out(c.count(0))
	for i in range(n):
		if c[i] == 0:
			out_(i + 1)
	out('')
main()


n = int(input())
b = []
row = []
for i in range(n):
	a = list(map(int, input().split()))
	b.append(a)
	if 1 in a or 3 in a:
		pass
	else:
		row.append(i + 1)
if len(row) > 0:
	print(len(row))
	print(*row)
else:
	print(0)


n = int(input())
res = []
a = [[0] * n] * n
for i in range(n):
	a[i] = list(map(int, input().split()))
for i in range(n):
	if a[i].count(1) > 0:
		continue
	elif a[i].count(3) == 0:
		res.append(i + 1)
if len(res) == 0:
	print(0)
	quit()
print(len(res))
res.sort()
print(' '.join(map(str, res)))


n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
d = {}
for i in range(n):
	for j in range(n):
		if l[i][j] == 1:
			d[i] = 1
		if l[i][j] == 2:
			d[j] = 1
		if l[i][j] == 3:
			d[i] = 1
			d[j] = 1
ans = []
for x in range(n):
	if d.get(x, 0) == 0:
		ans += [str(x + 1)]
print(len(ans))
print(' '.join(ans))


n = int(input())
k = []
for i in range(n):
	k.append(list(map(int, input().split())))
a = set()
for i in range(n):
	if 1 in k[i] or 3 in k[i]:
		continue
	else:
		a.add(i + 1)
a = list(sorted(a))
print(len(a))
print(*a)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect, insort
from time import perf_counter
from fractions import Fraction
import copy
from copy import deepcopy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')
n = L()[0]
A = [L() for i in range(n)]
s = set()
for i in range(1, n + 1):
	s.add(i)
for i in range(n):
	for j in range(n):
		if A[i][j] == 3:
			if i + 1 in s:
				s.remove(i + 1)
			if j + 1 in s:
				s.remove(j + 1)
		elif A[i][j] == 1:
			if i + 1 in s:
				s.remove(i + 1)
		elif A[i][j] == 2:
			if j + 1 in s:
				s.remove(j + 1)
print(len(s))
print(*sorted(list(s)))
endtime = time.time()


n = int(input())
ans = []
for j in range(n):
	c = True
	a = [i for i in input().split()]
	for i in a:
		if i == '1' or i == '3':
			c = False
	if c:
		ans.append(j + 1)
print(len(ans))
print(*ans)


ans = []
for i in range(int(input())):
	b = list(map(int, input().split()))
	if b.count(1) + b.count(3) == 0:
		ans += [i + 1]
print(len(ans))
print(' '.join(map(str, ans)))


n = int(input())
l = []
z = set()
for _ in range(n):
	l.append(list(map(int, input().split())))
if n == 1:
	print(1)
	print(1)
else:
	for i in range(n):
		for j in range(n):
			if i != j:
				if l[i][j] == 1:
					z.add(i)
				elif l[i][j] == 2:
					z.add(j)
				elif l[i][j] == 3:
					z.add(i)
					z.add(j)
	z = list(z)
	z.sort()
	k = n - len(z)
	if k:
		print(k)
		for i in range(n):
			if i not in z:
				print(i + 1, end=' ')
	else:
		print(0)


n = int(input())
l = []
for i in range(n):
	a = list(map(int, input().split()))
	if 1 in a or 3 in a:
		continue
	else:
		l.append(i + 1)
print(len(l))
print(*l)


import sys
n = int(input())
l = []
for i in range(n):
	li = list(map(int, input().split(sep=' ')))
	l.append(li)
good = []
bad = []
for i in range(n):
	good.append(i)
for i in range(n):
	for j in range(n):
		if l[i][j] == 0:
			pass
		elif l[i][j] == 1:
			if not i in bad:
				good.remove(i)
				bad.append(i)
		elif l[i][j] == 2:
			if not j in bad:
				good.remove(j)
				bad.append(j)
		elif l[i][j] == 3:
			if not i in bad:
				good.remove(i)
				bad.append(i)
			if not j in bad:
				good.remove(j)
				bad.append(j)
		else:
			continue
print(len(good))
if len(good) == 0:
	sys.exit(0)
for i in range(len(good)):
	sys.stdout.write(str(good[i] + 1) + ' ')


TN = 1

def solution():
	n = int(input())
	a = []
	ans = [0 for i in range(n)]
	for i in range(n):
		lst = list(map(int, input().split()))
		ans[i] += lst.count(1)
		ans[i] += lst.count(3)
	print(ans.count(0))
	for i in range(n):
		if ans[i] == 0:
			print(i + 1, end=' ')
	print()
while TN != 0:
	solution()
	TN -= 1


n = int(input())
total = 0
a = list()
for i in range(0, n):
	t = 0
	l = list(map(int, input().split(' ')))
	for j in l:
		if j == 1 or j == 3:
			t = 1
			break
	if t != 1:
		total = total + 1
		a.append(i + 1)
print(total)
if len(a) > 0:
	print(*a)


a = int(input())
b = []
d = []
z = 1
mensaje = ' '
mensaje1 = ''
numerito = 0
for n in range(1, a + 1):
	d.append(n)
for k in range(a):
	c = input()
	c = c.split()
	b.append(c)
for p in range(a):
	for o in range(z, a):
		if int(b[p][o]) == 3:
			d[o] = 0
			d[p] = 0
		if int(b[p][o]) == 1:
			d[p] = 0
		if int(b[p][o]) == 2:
			d[o] = 0
	z = z + 1
for yonax in range(a):
	if d[yonax] != 0:
		mensaje1 = mensaje1 + str(d[yonax]) + mensaje
		numerito = numerito + 1
if numerito > 0:
	print(numerito)
	print(mensaje1)
else:
	print('0')


n = int(input())
ans = []
for i in range(0, n):
	ok = True
	s = input()
	l = [int(x) for x in s.split()]
	for x in l:
		if x == 1 or x == 3:
			ok = False
	if ok == True:
		ans.append(i + 1)
print(len(ans))
for x in ans:
	print(x, end=' ')


def get_int():
	return map(int, input().split())
n = int(input())
a = []
for i in range(n):
	x = list(get_int())
	if 1 in x or 3 in x:
		continue
	a.append(i + 1)
print(len(a))
for i in a:
	print(i, end=' ')


n = int(input())
A = [list(map(int, input().split())) for i in range(n)]
cnt = 0
ans = []
for i in range(n):
	for j in range(n):
		if A[i][j] == 1 or A[i][j] == 3:
			break
	else:
		cnt += 1
		ans.append(i + 1)
print(cnt)
for i in ans:
	print(i, end=' ')


n = int(input())
theArray = [[0 for j in range(n)] for i in range(n)]
for i in range(n):
	therow = input().split()
	theArray[i] = therow
numgood = 0
listgood = []
for r in range(n):
	good = True
	for c in range(n):
		if theArray[r][c] == '1' or theArray[r][c] == '3':
			good = False
			break
	if good:
		numgood = numgood + 1
		listgood.append(r)
print(numgood)
for i in listgood:
	print(str(i + 1) + ' ', end='')


n = int(input())
event = []
for i in range(n):
	event.append([])
	input_string = list(map(lambda x: int(x), input().split()))
	for j in range(n):
		event[i].append(input_string[j])
scores = [0] * n
counter = 0
cheker = False
for i in range(n):
	for j in range(n):
		if i != j:
			if event[i][j] == 1 or event[i][j] == 3:
				cheker = True
				continue
	if not cheker:
		scores[i] = 'OK'
		counter += 1
	else:
		scores[i] = 'NO'
	cheker = False
ans_string = str(counter) + '\n'
for i in range(n):
	if scores[i] == 'OK':
		ans_string += str(i + 1) + ' '
print(ans_string)


n = int(input())
m = [True] * n
cnt = n
for i in range(n):
	t = list(map(int, input().split(' ')))
	for j in range(n):
		if t[j] == 3:
			if m[i]:
				cnt -= 1
				m[i] = False
			if m[j]:
				cnt -= 1
				m[j] = False
		elif t[j] == 2 and m[j]:
			cnt -= 1
			m[j] = False
		elif t[j] == 1 and m[i]:
			cnt -= 1
			m[i] = False
ans = str(cnt) + '\n'
for i in range(n):
	if m[i]:
		ans += str(i + 1) + ' '
print(ans)


from collections import defaultdict as dd
n = int(input())
count = 0
arr = []
if n == 1:
	print(1)
	print(1)
else:
	dic = dict()
	for i in range(n):
		dic[i] = 1
	for i in range(n):
		k = list(map(int, input().split()))
		arr.append(k)
	for i in range(n):
		for j in range(n):
			if arr[i][j] == 3:
				dic[i] -= 1
				dic[j] -= 1
			elif arr[i][j] == 2:
				dic[j] -= 1
			elif arr[i][j] == 1:
				dic[i] -= 1
			elif arr[i][j] == -1:
				pass
			else:
				pass
	check = []
	for (i, j) in dic.items():
		if j > 0:
			count += 1
			check += [i + 1]
	check.sort()
	check = list(map(str, check))
	print(count)
	print(' '.join(check))


n = int(input())
face = list()
for i in range(n):
	line = str(input()).split()
	if '1' not in line and '3' not in line:
		face.append(str(i + 1))
print(len(face))
if len(face) > 0:
	print(' '.join(face))


n = int(input())
t = 0
a = []
k = [[False for i in range(n)] for i in range(n)]
h = []
for i in range(0, n):
	a.append(list(map(int, input().split())))
for i in range(0, n):
	for j in range(0, n):
		if a[i][j] != 3 and a[i][j] != 1:
			k[i][j] = True
	if k[i] == [True for i in range(n)]:
		t += 1
		h.append(i + 1)
print(t)
print(*h)


n = int(input())
a = []
for i in range(n):
	a.append([int(x) for x in input().split()])
res = []
for i in range(n):
	ok = True
	for j in range(n):
		if a[i][j] == 1 or a[i][j] == 3:
			ok = False
	if ok:
		res.append(i + 1)
print(len(res))
print(' '.join((str(x) for x in res)))


n = int(input())
row = [[int(x) for x in input().split()] for i in range(n)]
col = [[row[i][j] for i in range(n)] for j in range(n)]
ans = [i for i in range(1, n + 1)]
for i in range(1, n + 1):
	if 1 in row[i - 1] or 3 in row[i - 1] or 2 in col[i - 1] or (3 in col[i - 1]):
		try:
			ans.remove(i)
		except:
			pass
print(len(ans))
print(' '.join([str(x) for x in ans]))


n = int(input())
cars = ['yes' for x in range(n)]
for x in range(n):
	string = input()
	results = string.split(' ')
	for y in range(n):
		results[y] = int(results[y])
	for y in range(n):
		value = results[y]
		if value == 1:
			cars[x] = 'no'
		elif value == 2:
			cars[y] = 'no'
		elif value == 3:
			cars[x] = 'no'
			cars[y] = 'no'
a = 0
values = []
for x in range(n):
	if cars[x] == 'yes':
		values.append(str(x + 1))
		a += 1
print(a)
print(' '.join(values))


(n, x, X) = (int(input()), 0, [])
for i in range(n):
	A = list(map(int, input().split()))
	if 1 in A or 3 in A:
		continue
	else:
		x += 1
		X.append(i + 1)
print(x)
print(*X)


n = int(input())
M = []
for i in range(n):
	temp = list(map(int, input().split(' ')))
	M.append(temp)
ans = 0
result = []
for i in range(n):
	c = 0
	for j in range(n):
		if i == j:
			continue
		if M[i][j] == 0 or M[i][j] == 2:
			c += 1
	if c == n - 1:
		ans += 1
		result.append(i + 1)
print(ans)
for i in result:
	print(i, end=' ')


n = int(input())
List = []
final = []
for i in range(n):
	List.append(list(map(int, input().split())))
for i in range(n):
	if 3 not in List[i] and 1 not in List[i]:
		final.append(i + 1)
print(len(final))
print(*final)


import sys

def solve():
	(i, nGCars, GCars) = (1, 0, [])
	ignore = input()
	for line in sys.stdin:
		for c in line.split():
			r = int(c)
			if r == 1 or r == 3:
				break
		else:
			GCars.append(str(i))
			nGCars += 1
		i += 1
	print(nGCars)
	print(' '.join(GCars))
solve()


x = int(input())
c = x
p = [0] * x
for i in range(x):
	t = list(map(int, input().split()))
	if 3 in t or 1 in t:
		p[i] = -1
		c -= 1
print(c)
for i in range(x):
	if p[i] != -1:
		print(i + 1, end=' ')


import sys
n = int(input())
mat = []
ans = []
for i in range(n):
	l = list(map(int, sys.stdin.readline().split()))
	mat.append(l)
	good = True
	for j in range(n):
		if l[j] == 1 or l[j] == 3:
			good = False
	if good:
		ans.append(i + 1)
num = len(ans)
print(num)
if num > 0:
	print(' '.join(map(str, ans)))


n = int(input())
a = [[0 for x in range(n + 1)] for c in range(n + 1)]
for i in range(1, n + 1):
	a[i] = [0] + list(map(int, input().split()))
b = []
for i in range(1, n + 1):
	if 1 not in a[i] and 3 not in a[i]:
		for j in range(1, n + 1):
			if 2 == a[j][i]:
				break
		else:
			b.append(i)
print(len(b))
if len(b):
	print(*b)


cars = int(input())
ans = 0
ansline = []
for i in range(cars):
	inputline = [int(j) for j in input().split()]
	inputline = set(inputline)
	if 1 not in inputline and 3 not in inputline:
		ans += 1
		ansline.append(i + 1)
print(ans)
ansline.sort()
a = ''
if ans > 0:
	for i in range(ans):
		a += str(ansline[i]) + ' '
print(a)


n = int(input())
g = []
for i in range(n):
	a = input().split()
	f = True
	for j in range(n):
		if i == j:
			continue
		if a[j] != '0' and a[j] != '2':
			f = False
			break
	if f:
		g.append(i)
print(len(g))
for i in g:
	print(i + 1, end=' ')


n = int(input())
a = []
for i in range(n):
	a1 = list(map(int, input().split()))
	a.append(a1)
l = []
for i in range(n):
	for j in range(n):
		if a[i][j] == 1:
			if i + 1 not in l:
				l.append(i + 1)
		elif a[i][j] == 2:
			if j + 1 not in l:
				l.append(j + 1)
		elif a[i][j] == 3:
			if i + 1 not in l:
				l.append(i + 1)
			if j + 1 not in l:
				l.append(j + 1)
print(n - len(l))
for i in range(1, n + 1):
	if i not in l:
		print(i, end=' ')
print()


ls = []
n = int(input())
ans = [1 for i in range(n)]
for i in range(n):
	l = list(map(int, input().split()))
	ls.append(l)
for i in range(n):
	for j in range(n):
		if ls[i][j] >= 1:
			if ls[i][j] == 1:
				ans[i] = False
			elif ls[i][j] == 2:
				ans[j] = False
			else:
				ans[i] = False
				ans[j] = False
x = []
for i in range(n):
	if ans[i]:
		x.append(i + 1)
print(len(x))
if len(x) > 0:
	print(*x)


(n, b) = (int(input()), [])
for i in range(n):
	a = input().split()
	for k in range(n):
		if a[k] in '13':
			b.append(i + 1)
		if a[k] in '23':
			b.append(k + 1)
a = set(range(1, n + 1)) - set(b)
print(len(a))
print(*sorted(a))


import sys
n = int(input())
m = []
for i in range(n):
	m.append(input().split())
results_board = {}
for i in range(n):
	results_board[i] = 0
for i in range(n):
	for j in range(n):
		if m[i][j] == '3' or m[i][j] == '1':
			results_board[i] += 1
good_cars_count = 0
good_cars_indexes = []
for i in range(n):
	if results_board[i] == 0:
		good_cars_count += 1
		good_cars_indexes.append(str(i + 1))
print(good_cars_count)
print(' '.join(good_cars_indexes))


import math, string, itertools, fractions, heapq, collections, re, array, bisect
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict

def main(a, n):
	s = []
	if n == 1:
		print(1)
		print(1)
		return
	for i in range(n):
		if 1 in a[i] or 3 in a[i]:
			continue
		s += [i + 1]
	print(len(s))
	print(' '.join([str(i) for i in s]))

def main_input(info=0):
	n = int(input())
	a = []
	for i in range(n):
		a.append(list(map(int, input().split())))
	main(a, n)

def __starting_point():
	main_input()
__starting_point()


N = int(input())
good_cars = []
for i in range(N):
	collision = list(map(int, input().split()))
	if collision.count(1) + collision.count(3) == 0:
		good_cars.append(i)
print(len(good_cars))
if len(good_cars) != 0:
	print(' '.join(map(lambda x: str(x + 1), good_cars)))


n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
ans = []
for i in range(n):
	a[i].remove(-1)
	ok = 1
	for j in range(n - 1):
		if a[i][j] & 1:
			ok = 0
	if ok:
		ans.append(i + 1)
print(len(ans))
print(' '.join(map(str, ans)))


num_cars = int(input())
num_good_cars = 0
bad_cars = set()
good_cars = []
collisions = list()
for _ in range(num_cars):
	collisions.append(list(map(int, input().split())))
for car in range(num_cars):
	if car not in bad_cars:
		for other_car in range(num_cars):
			if collisions[car][other_car] == -1:
				continue
			elif collisions[car][other_car] == 0:
				continue
			elif collisions[car][other_car] == 1:
				bad_cars.add(car)
				break
			elif collisions[car][other_car] == 2:
				bad_cars.add(other_car)
			else:
				bad_cars.add(car)
				bad_cars.add(other_car)
				break
		if car not in bad_cars:
			num_good_cars += 1
			good_cars.append(repr(car + 1))
print(num_good_cars)
print(' '.join(good_cars))


n = int(input())
col = []
ans = []
for i in range(n):
	col.append(list(map(int, input().split())))
	ans.append(i)
for i in range(n):
	for j in range(n):
		if (col[i][j] == 2 or col[i][j] == 3) and j in ans:
			ans.remove(j)
		if col[i][j] == 1 and i in ans:
			ans.remove(i)
if not ans:
	print('0')
else:
	ans = [str(i + 1) for i in ans]
	print(len(ans))
	print(' '.join(ans))


gi = lambda : list(map(int, input().strip().split()))
(n,) = gi()
m = [gi() for _ in range(n)]
ans = []
k = 0
for e in m:
	k += 1
	if 1 not in e and 3 not in e:
		ans.append(str(k))
print(len(ans))
print(' '.join(ans))


n = int(input())
t = [i for i in range(1, n + 1)]
s = []
for j in range(1, n + 1):
	s = list(map(int, input().split()))
	for k in range(1, n + 1):
		if s[k - 1] == -1:
			pass
		elif s[k - 1] == 0:
			pass
		elif s[k - 1] == 1:
			if j in t:
				t.remove(j)
		elif s[k - 1] == 2:
			if k in t:
				t.remove(k)
		else:
			if k in t:
				t.remove(k)
			if j in t:
				t.remove(j)
print(len(t))
print(*t)


n = int(input())
l = []
for i in range(n):
	k = list(map(int, input().split()))
	if 1 not in k and 3 not in k:
		l.append(i + 1)
print(len(l))
print(*l)


n = int(input())
l = []
for _ in range(n):
	l.append(list(map(int, input().split())))
co = 0
lp = []
for i in range(n):
	li = []
	for j in range(n):
		li.append(l[j][i])
	if 1 not in l[i] and 2 not in li and (3 not in li) and (3 not in l[i]):
		co += 1
		lp.append(i + 1)
print(co)
lp.sort()
print(*lp, sep=' ')


(n, g) = (int(input()), [])
for i in range(n):
	if all((x != 1 and x != 3 for x in map(int, input().split()))):
		g.append(i + 1)
print(len(g))
print(' '.join(map(str, g)))


import sys
n = int(input())
ans = []
for i in range(0, n):
	f = map(int, input().split(' '))
	found = True
	for j in f:
		if j == 1 or j == 3:
			found = False
			break
	if found:
		ans += [i + 1]
print(len(ans))
for i in ans:
	sys.stdout.write('%d ' % i)
print()


n = int(input())
li = []
for i in range(n):
	if all((int(i) <= 0 or int(i) == 2 for i in input().split())):
		li.append(i + 1)
print(len(li))
print(*li)


n = int(input())
matrix = []
for i in range(n):
	line = [int(x) for x in input().split()]
	matrix.append(line)
goodCars = []
for i in range(0, n):
	flag = True
	for j in range(0, n):
		if matrix[i][j] == 1 or matrix[i][j] == 3:
			flag = False
			break
	if flag:
		goodCars.append(i + 1)
print(len(goodCars))
for i in range(len(goodCars)):
	print(goodCars[i], end=' ')
if len(goodCars):
	print()


n = int(input())
a = []
c = 0
ans = []
for i in range(n):
	t = list(map(int, input().split()))
	a.append(t)
num = 0
for i in a:
	if not 1 in i and (not 3 in i):
		c += 1
		ans.append(num + 1)
	num += 1
print(c)
for i in range(c - 1):
	print(ans[i], end=' ')
if c:
	print(ans[c - 1])


n = int(input())
ans = []
for i in range(n):
	mas = [int(x) for x in input().split()]
	tr = True
	for x in mas:
		if x == 1 or x == 3:
			tr = False
			break
	if tr:
		ans.append(i + 1)
print(len(ans))
ans = [str(x) for x in ans]
print(' '.join(ans))


N = int(input())
good_cars = []
for i in range(N):
	a = set(map(int, input().split()))
	if 1 not in a and 3 not in a:
		good_cars.append(i + 1)
print(len(good_cars))
if len(good_cars) > 0:
	print(*good_cars)


n = int(input())
cnt = 0
cars = []
for i in range(n):
	r = [int(r) for r in input().split()]
	good = True
	for j in range(n):
		if r[j] == 1 or r[j] == 3:
			good = False
			break
	if good:
		cnt += 1
		cars.append(i + 1)
print(cnt)
print(*cars)


n = int(input())
result = ''
for i in range(n):
	x = input().split()
	if '1' not in x and '3' not in x:
		result += str(i + 1) + ' '
result = result[:-1]
print(len(result.split()))
print(result)


n = int(input())
matriz = []
vec = []
for i in range(n):
	vec.append(i + 1)
for j in range(n):
	t = input()
	x = t.split()
	matriz.append(x)
for i in range(n):
	for j in range(n):
		if matriz[i][j] != '-1':
			if matriz[i][j] == '1':
				vec[i] = 0
			if matriz[i][j] == '2':
				vec[j] = 0
			if matriz[i][j] == '3':
				vec[i] = 0
				vec[j] = 0
ptr = ''
y = 0
for i in range(n):
	if vec[i] != 0:
		y += 1
		ptr += str(vec[i]) + ' '
if y > 0:
	print(y)
	print(ptr)
else:
	print(y)


n = int(input())
res = []
for i in range(n):
	good = True
	row = input()
	for j in row.split():
		if j == '1' or j == '3':
			good = False
			break
	if good:
		res.append(i + 1)
print(len(res))
for i in res:
	print(i, end=' ')


n = int(input())
t = [False] * n
x = [list(map(int, input().split(' '))) for i in range(n)]
for i in range(n):
	for j in range(n):
		if x[i][j] == 1:
			t[i] = True
		elif x[i][j] == 2:
			t[j] = True
		elif x[i][j] == 3:
			t[i] = True
			t[j] = True
ct = 0
print(t.count(False))
x = [str(i + 1) for i in range(n) if t[i] == False]
print(' '.join(x))


n = int(input())
a = [1] * n
for i in range(n):
	m = list(map(int, input().split()))
	for t in range(n):
		if m[t] == 1:
			a[i] = 0
		elif m[t] == 2:
			a[t] = 0
		elif m[t] == 3:
			a[t] = a[i] = 0
print(a.count(1))
print(*[i + 1 for i in range(n) if a[i] == 1])


n = int(input())
r = []
for i in range(n):
	s = input()
	a = s.split(' ')
	if '1' not in a and '3' not in a:
		r.append(i + 1)
print(len(r))
for i in r:
	print(i, end=' ')


n = int(input())
l = [0] * n
for i in range(n):
	l[i] = map(int, input().split(' '))
c = n
l2 = []
for i in l:
	flag = 0
	for j in i:
		if j == 1 or j == 3:
			c = c - 1
			flag = 1
			break
	if flag == 0:
		l2.append(l.index(i) + 1)
print(c)
print(*l2)


def solve():
	ans = []
	n = int(input())
	for i in range(1, n + 1):
		a = list(map(int, input().split()))
		if all([x == -1 or x % 2 == 0 for x in a]):
			ans.append(i)
	print(len(ans))
	print(' '.join(map(str, ans)))
solve()


n = int(input())
A = []
for i in range(0, n):
	s = input()
	a = 0
	for j in s.split():
		j = int(j)
		if j == 1 or j == 3:
			a = 1
			break
	if a == 0:
		A.append(str(i + 1))
v = ''
for p in A:
	v = v + p + ' '
print(len(A))
print(v)


n = int(input())
ans = []
for i in range(n):
	r = input().split()
	ci = True
	for j in range(n):
		if j != i:
			if r[j] == '1' or r[j] == '3':
				ci = False
	if ci:
		ans.append(str(i + 1))
print(len(ans))
if ans:
	print(' '.join(ans))


cars = []
for i in range(int(input())):
	a = 0
	for x in map(int, str.split(input())):
		if x > 0:
			a |= x
	if a & 1 == 0:
		cars.append(i + 1)
print(len(cars))
if cars:
	print(str.join(' ', map(str, cars)))


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
p = []
c = 0
for i in range(n):
	if set(l[i]) <= set([0, -1, 2]):
		c += 1
		p.append(i + 1)
print(c)
print(*p)


n = int(input())
lst = [0] * n
for i in range(n):
	s = input().split()
	for j in range(n):
		if s[j] == '1':
			lst[i] = 1
		elif s[j] == '2':
			lst[j] = 1
		elif s[j] == '3':
			(lst[i], lst[j]) = (1, 1)
count = 0
lstn = []
for i in range(n):
	if lst[i] == 0:
		lstn.append(i)
		count += 1
print(count)
for j in lstn:
	print(j + 1, end=' ')


n = int(input())
good = []
num = 0
for i in range(n):
	car = list(input().split())
	if '1' in car or '3' in car:
		continue
	else:
		good.append(i + 1)
		num += 1
print(num)
if good:
	print(*good, sep=' ')


n = int(input())
matrix = []
for i in range(n):
	matrix.append(list(map(int, input().split())))
cont = 0
res = []
flag = True
for i in range(n):
	for j in range(n):
		if matrix[i][j] == 3 or matrix[i][j] == 1:
			flag = False
	if flag == True:
		cont += 1
		res.append(i + 1)
	flag = True
print(cont)
print(' '.join(map(str, res)))


n = int(input())
x = []
for i in range(n):
	x.append([int(q) for q in input().split()])
ans = 0
t = []
for i in range(n):
	if 1 not in x[i] and 3 not in x[i]:
		ans += 1
		t.append(i + 1)
print(ans)
print(*t)


n = int(input())
a = []
ans = []
for i in range(n):
	b = list(map(int, input().split()))
	if 1 not in b and 3 not in b:
		ans.append(i + 1)
print(len(ans))
if len(ans) != 0:
	print(*ans)


l = []
for i in range(int(input())):
	l.append(input())
ll = []
for i in range(len(l)):
	cars = list(set(map(int, l[i].split())))
	if cars and all((elem in [0, 2, -1] for elem in cars)):
		ll.append(i + 1)
print(len(ll))
for i in ll:
	print(i, end=' ')


n = int(input())
res = []
for i in range(n):
	s = set(map(int, input().split()))
	if not (1 in s or 3 in s):
		res += [str(i + 1)]
print(len(res))
print(' '.join(res))


n = int(input())
a = []
for i in range(n):
	x = input().split()
	a.append(x)
ans = []
for i in range(n):
	for j in range(n):
		if a[i][j] == '3' or a[i][j] == '1':
			ans.append(i + 1)
			break
print(n - len(ans))
for i in range(1, n + 1):
	if i not in ans:
		print(i, end=' ')


n = int(input())
mat = [list(map(int, input().split())) for i in range(n)]
good_cars = []
for (i, row) in enumerate(mat, 1):
	for a in row:
		if a == 3 or a == 1:
			break
	else:
		good_cars.append(i)
print(len(good_cars))
if good_cars:
	print(*good_cars)


n = int(input())
a = []
k = 0
while k < n:
	s = input()
	a.append([int(i) for i in s.split()])
	k += 1
m = 0
d = []
for i in range(n):
	m = 0
	for j in range(n):
		if a[i][j] == 1 or a[i][j] == 3:
			m += 1
	if m == 0:
		d.append(i + 1)
d.sort()
print(len(d))
for i in range(0, len(d)):
	print(d[i], end=' ')


n = int(input())
data = []
for i in range(n):
	subdata = input()
	subdata = subdata.split()
	for i in range(len(subdata)):
		subdata[i] = int(subdata[i])
	data.append(subdata)
car = []
for i in range(n):
	car.append(0)
for i in range(n):
	for j in range(i + 1, n):
		if data[i][j] == 1:
			car[i] += 1
		if data[i][j] == 2:
			car[j] += 1
		if data[i][j] == 3:
			car[i] += 1
			car[j] += 1
count = 0
for i in range(n):
	if car[i] == 0:
		count += 1
print(count)
for i in range(n):
	if car[i] == 0:
		print(i + 1, end=' ')


n = int(input())
matrix = [[int(i) for i in input().split()] for j in range(n)]
cars = [True] * n
for i in range(len(matrix)):
	for j in range(len(matrix)):
		if matrix[i][j] == 1:
			cars[i] = False
		if matrix[i][j] == 2:
			cars[j] = False
		if matrix[i][j] == 3:
			(cars[i], cars[j]) = (False, False)
print(cars.count(True))
for i in range(len(cars)):
	if cars[i] == True:
		print(i + 1, end=' ')


n = int(input())
l1 = []
for i in range(n):
	l = list(map(int, input().split()))
	if 1 in l or 3 in l:
		pass
	else:
		l1.append(i + 1)
print(len(l1))
print(*l1)


n = int(input())
a = []
for i in range(1, n + 1):
	c = list(map(int, input().split()))
	for j in range(n):
		if c[j] == 1 or c[j] == 3:
			break
	else:
		a.append(i)
print(len(a))
print(*a)


cases = int(input())
ans = []
i = 0
while cases:
	cases -= 1
	i += 1
	arr = list(map(int, input().split()))
	if arr.count(3) == arr.count(1) == 0:
		ans.append(i)
print(len(ans))
print(*ans)


import string

def main_function():
	database = [[int(i) for i in input().split(' ')] for i in range(int(input()))]
	lost_ones = []
	for i in range(len(database)):
		for j in range(len(database)):
			if database[i][j] == 1 or database[i][j] == 3:
				lost_ones.append(i + 1)
	return str(len([str(i) for i in range(1, len(database) + 1) if not i in lost_ones])) + '\n' + ' '.join([str(i) for i in range(1, len(database) + 1) if not i in lost_ones])
print(main_function())


a = int(input())
x = []
for i in range(a):
	x.append([int(x) for x in input().split()])
ans = []
for i in range(a):
	cont = True
	for j in range(a):
		if x[i][j] == 1 or x[i][j] == 3:
			cont = False
	if cont:
		ans.append(i + 1)
print(len(ans))
print(*ans)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = [LI() for _ in range(n)]
	r = []
	for i in range(n):
		c = a[i]
		if 1 in c or 3 in c:
			continue
		r.append(i + 1)
	return '{}\n{}'.format(len(r), ' '.join(map(str, r)))
print(main())


n = int(input())
a = [[0] * n for i in range(0, n)]
for i in range(0, n):
	a[i] = list(map(int, input().split()))
b = [1] * n
for i in range(0, n):
	for j in range(0, n):
		if a[i][j] == 1:
			b[i] = 0
		if a[i][j] == 2:
			b[j] = 0
		if a[i][j] == 3:
			b[i] = 0
			b[j] = 0
print(sum(b))
for i in range(0, n):
	if b[i] > 0:
		print(i + 1, end=' ')


n = int(input())
t = [0] * n
for i in range(n):
	z = list(map(int, input().split()))
	for j in range(n):
		if z[j] == 1:
			t[i] = 1
		elif z[j] == 2:
			t[j] = 1
		elif z[j] == 3:
			t[i] = t[j] = 1
print(t.count(0))
for i in range(n):
	if not t[i]:
		print(i + 1, end=' ')


ans = []
for i in range(int(input())):
	line = input().split()
	if '1' in line or '3' in line:
		continue
	ans.append(str(i + 1))
print(len(ans))
print(' '.join(ans))


n = int(input())
M = [list(map(int, input().split())) for i in range(n)]
k = 0
l = []
for i in range(n):
	k1 = 0
	for j in range(n):
		if M[i][j] == 1 or M[i][j] == 3:
			k1 = k1 + 1
			break
	if k1 == 0:
		k = k + 1
		l.append(str(i + 1))
print(k)
print(' '.join(l))


n = int(input())
L = []
for j in range(n):
	T = [int(x) for x in input().split()]
	for i in T:
		if i == 3 or i == 1:
			break
	else:
		L.append(j)
print(len(L))
for i in L:
	print(i + 1, end=' ')


n = int(input())
z = []
res = n
for i in range(n):
	s = input().split()
	j = 0
	t = True
	while t and j < n:
		if s[j] == '1' or s[j] == '3':
			t = False
			res -= 1
		j += 1
	z.append(t)
print(res)
s = ''
for i in range(len(z)):
	if z[i]:
		s += str(i + 1) + ' '
print(s)


result = [str(i + 1) for i in range(int(input())) if sum((v in set([1, 3]) for v in map(int, input().split()))) == 0]
print(len(result))
if result:
	print(' '.join(result))


x = int(input())
l = []
for i in range(x):
	l.append(list(map(int, input().split())))
good = [1] * x
for i in range(x):
	for j in range(x):
		if l[i][j] == 1:
			good[i] = 0
		elif l[i][j] == 2:
			good[j] = 0
		elif l[i][j] == 3:
			good[i] = good[j] = 0
print(sum(good))
for i in range(x):
	if good[i]:
		print(i + 1, end=' ')
print()


a = int(input())
A = [0] * a
for q in range(a):
	B = list(map(float, input().split()))
	for i in range(a):
		if B[i] == 1:
			A[q] = A[q] + 1
		elif B[i] == 2:
			A[i] = A[i] + 1
		elif B[i] == 3:
			A[q] = A[q] + 1
			A[i] = A[i] + 1
c = 0
C = ''
for i in range(a):
	if A[i] == 0:
		C = C + str(i + 1) + ' '
		c = c + 1
print(c)
if c != 0:
	print(C)


n = int(input())
row = []
col = []
ans = 0
r = []
for i in range(n):
	col = list(map(int, input().split()))[:n]
	row.append(col)
for i in range(n):
	c = 0
	for j in range(n):
		if i == j:
			continue
		if row[i][j] == 0 or row[i][j] == 2:
			c += 1
	if c == n - 1:
		ans += 1
		r.append(i + 1)
print(len(r))
print(*r, sep=' ')


n = int(input())
(a, l) = ([], [])
for x in range(n):
	k = list(map(int, input().split()))
	a.append(k)
for x in range(n):
	if 1 not in a[x] and 3 not in a[x]:
		b = []
		for y in range(n):
			b.append(a[y][x])
		if 2 not in b and 3 not in b:
			l.append(x + 1)
print(len(l))
print(*l)


class good(object):

	def __init__(self, n, a):
		self.n = n
		self.a = a
		pass

	def good_car(self):
		x = 0
		self.y = list()
		for i in range(self.n):
			if not 1 in self.a[i] and (not 3 in self.a[i]):
				x += 1
				self.y.append(i + 1)
		return x

	def this_is_list(self):
		for i in self.y:
			print(i, end=' ')
n = int(input())
a = list()
for i in range(n):
	s = [int(i) for i in input().split()]
	a.append(s)
test = good(n, a)
print(test.good_car())
test.this_is_list()


N = int(input())
A = []
for i in range(N):
	F = input()
	A.append(F)
c = 0
I = []
ncarros = 0
for i in range(N):
	A[i] = A[i].split()
	for j in A[i]:
		if j != '1' and j != '3':
			c += 1
		if c == N:
			I.append(i + 1)
			ncarros += 1
	c = 0
print(ncarros)
if len(I) != 0:
	v = str(I[0])
	for i in range(len(I)):
		if i != len(I) - 1:
			v = v + ' ' + str(I[i + 1])
	print(v)


n = int(input())
arr = [[] for i in range(n)]
r = lambda : list(map(int, input().split()))
for i in range(n):
	arr[i] = r()
c = 0
car = []
for (idx, i) in enumerate(arr):
	if 1 not in i and 3 not in i:
		car.append(idx + 1)
print(len(car))
print(*car)


from sys import stdin
n = int(stdin.readline())
ra = []
for i in range(0, n):
	z = 0
	for j in stdin.readline().split():
		if j == '1' or j == '3':
			z += 1
	if z == 0:
		ra.append(str(i + 1))
c = len(ra)
print(c)
if c != 0:
	print(' '.join(ra))


n = int(input())
goodcars = []
for i in range(n):
	a = [int(c) for c in input().split()]
	good = True
	for j in range(n):
		if a[j] == 1 or a[j] == 3:
			good = False
			break
	if good:
		goodcars.append(i + 1)
print(len(goodcars))
if len(goodcars) > 0:
	print(' '.join((str(c) for c in goodcars)))


n = int(input())
res = []
for i in range(n):
	f = True
	l = map(int, input().split())
	for x in l:
		if x == 1 or x == 3:
			f = False
	if f:
		res.append(i + 1)
print(len(res))
print(' '.join(map(str, res)))


n = int(input())
s = n
mark = [False] * (n + 1)
z = set(range(1, n + 1))
for i in range(1, n + 1):
	tmp = list(map(int, input().split()))
	for j in range(i):
		if tmp[j] == 1:
			if mark[i] == False:
				z = z - {i}
				s = s - 1
			mark[i] = True
		if tmp[j] == 2:
			if mark[j + 1] == False:
				z = z - {j + 1}
				s = s - 1
			mark[j + 1] = True
		if tmp[j] == 3:
			if mark[i] == False:
				z = z - {i}
				s = s - 1
			if mark[j + 1] == False:
				z = z - {j + 1}
				s = s - 1
			mark[i] = True
			mark[j + 1] = True
print(s)
z = list(z)
z.sort()
if s != 0:
	print(*z)


n = int(input())
ans = []
for i in range(n):
	if all((max(int(x), 0) & 1 == 0 for x in input().split())):
		ans.append(i + 1)
print(len(ans))
print(' '.join([str(x) for x in ans]))


n = int(input())
ans = []
for i in range(n):
	ls = list(map(int, input().split()))
	if 3 not in ls and 1 not in ls:
		ans.append(i + 1)
print(len(ans))
print(*ans)


n = int(input())
lis = []
ans = [0] * (n + 1)
for i in range(n):
	a = list(map(int, input().split()))
	lis.append(a)
for i in range(n):
	for j in range(n):
		if lis[i][j] == 1:
			ans[i + 1] = -1
		elif lis[i][j] == 3:
			ans[i + 1] = -1
			ans[j + 1] = -1
	for k in range(n):
		if lis[k][i] == 1:
			ans[k + 1] = -1
		elif lis[k][i] == 3:
			ans[k + 1] = -1
			ans[i + 1] = -1
c = 0
a = []
for i in range(1, n + 1):
	if ans[i] != -1:
		c += 1
		a.append(i)
print(c)
print(*a)


n = int(input())
matrix = [list(map(int, input().split())) for i in range(n)]
c = 0
i = 2
j = 1
k = []
for i in range(0, n):
	if 1 in matrix[i] or 3 in matrix[i]:
		pass
	else:
		c += 1
		k.append(i + 1)
print(c)
print(' '.join([str(x) for x in k]))


n = int(input())
good = []
for i in range(n):
	a = list(map(int, input().split()))
	found = False
	for j in a:
		if j == 1 or j == 3:
			found = True
	if found == False:
		good.append(i + 1)
print(len(good))
for i in good:
	print(i, end=' ')


n = int(input())
l = [0 for x in range(n)]
p = []
for o in range(n):
	q = [int(x) for x in input().split()]
	p.append(q)
for i in range(n):
	for j in range(n):
		if p[i][j] == 1:
			l[i] = 1
		elif p[i][j] == 2:
			l[j] = 1
		elif p[i][j] == 3:
			l[i] = 1
			l[j] = 1
print(l.count(0))
for i in range(n):
	if l[i] == 0:
		print(i + 1, end=' ')


n = int(input())
x = []
for i in range(n):
	a = list(map(int, input().split()))
	x.append(a)
c = 0
z = []
for i in range(n):
	k = True
	for j in range(n):
		if x[i][j] == 3 or x[i][j] == 1:
			k = False
			break
	if k:
		c += 1
		z.append(i + 1)
print(c)
for i in z:
	print(i, end=' ')


n = int(input())
a = []
for i in range(n):
	ma = list((int(s) for s in input().split(' ')))
	if not (1 in ma or 3 in ma):
		a.append(i + 1)
print(len(a))
for x in a:
	print(x, end=' ')


n = int(input())
a = []
for i in range(n):
	b = list(map(int, input().split()))
	a.append(b)
ans = []
for i in range(n):
	flag = 0
	for c in a[i]:
		if c == 1 or c == 3:
			flag = 1
			break
	if not flag:
		ans.append(i + 1)
for j in range(n):
	flag = 0
	for i in range(n):
		if a[i][j] == 2 or a[i][j] == 3:
			flag = 1
			break
	if not flag:
		ans.append(j + 1)
ans = list(set(ans))
ans.sort()
print(len(ans))
for c in ans:
	print(c, end=' ')


n = int(input())
M = [list(map(int, input().split())) for _ in range(n)]
R = [1 for _ in range(n)]
for i in range(n - 1):
	for j in range(i + 1, n):
		if M[i][j] == 3:
			R[i] = R[j] = 0
		elif M[i][j] == 1:
			R[i] = 0
		elif M[i][j] == 2:
			R[j] = 0
print(sum(R))
for i in range(n):
	if R[i]:
		print(i + 1, end=' ')


N = int(input())
mat = [list(map(int, input().split())) for _ in range(N)]
ans = []
for i in range(N):
	flag = True
	for j in range(N):
		if mat[i][j] == 3 or mat[i][j] == 1:
			flag = False
	if flag == True:
		ans.append(i + 1)
if len(ans) == 0:
	print(0)
else:
	print(len(ans))
	print(*ans)


n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
res = []
for i in range(n):
	j = 0
	while j < n and 3 != a[i][j] != 1:
		j += 1
	if j == n:
		res.append(i + 1)
print(len(res))
print(' '.join(map(str, res)))


n = int(input())
s = []
ans = []
for i in range(n):
	s.append(list(map(int, input().split())))
for i in range(n):
	f = True
	for j in range(n):
		if s[i][j] == 1 or s[j][i] == 2 or s[i][j] == 3 or (s[j][i] == 3):
			f = False
	if f:
		ans.append(i)
print(len(ans))
for i in ans:
	print(i + 1, end=' ')


def solve(arr, n):
	good = []
	for i in range(n):
		is_good = True
		for j in arr[i]:
			if j not in [-1, 0, 2]:
				is_good = False
				break
		if is_good:
			good.append(i + 1)
	print(len(good))
	print(*good)

def main():
	n = int(input())
	arr = []
	for _ in range(n):
		i = list(map(int, input().split(' ')))
		arr.append(i)
	solve(arr, n)
main()


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
a = []
for i in range(n):
	a.append(array())
ans = [1] * n
for i in range(n):
	for j in range(n):
		if a[i][j] == 1:
			ans[i] = 0
		elif a[i][j] == 2:
			ans[j] = 0
		elif a[i][j] == 3:
			ans[i] = 0
			ans[j] = 0
print(ans.count(1))
for i in range(n):
	if ans[i]:
		print(i + 1, end=' ')


n = int(input())
r = lambda : list(map(int, input().split()))
cars = [True] * n
for _ in range(n):
	i = ' ' + input()
	if ' 1' in i or ' 3' in i:
		cars[_] = False
print(sum(cars))
print(' '.join((str(i + 1) for (i, x) in enumerate(cars) if x)))


n = int(input())
a = [i + 1 for i in range(n) if {*map(int, input().split())} & {1, 3} < {1}]
print(len(a))
print(*a)


rows = int(input())
cars = []
for i in range(0, rows):
	cars.append(True)
matrix = []
for i in range(0, rows):
	matrix.append([int(x) for x in input().split()])
total = 0
for i in range(0, len(matrix)):
	if 1 not in matrix[i] and 3 not in matrix[i]:
		total += 1
print(total)
for i in range(0, len(matrix)):
	if 1 not in matrix[i] and 3 not in matrix[i]:
		print(i + 1, '', end='')


n = int(input())
good = set()
good_n = 0
bad = set()
for i in range(n):
	nums = [int(x) for x in input().split()]
	for j in range(n):
		if nums[j] == 0 or nums[j] == 2:
			good.add(i + 1)
			if nums[j] == 2:
				bad.add(j + 1)
		if nums[j] == 0 or nums[j] == 1:
			good.add(i + 1)
			if nums[j] == 1:
				bad.add(i + 1)
		if nums[j] == 3:
			bad.add(i + 1)
			bad.add(j + 1)
if n == 1:
	print(1)
	print(1)
else:
	s = []
	for g in good:
		if g not in bad:
			s.append(g)
	print(len(s))
	s.sort()
	print(*s)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline().strip())
n = get_int()
count = 0
lst = []
for i in range(n):
	s = get_string().split()
	if '1' not in s and '3' not in s:
		count += 1
		lst.append(i + 1)
print(count)
print(*lst)


n = int(input())
A = []
for i in range(n):
	A.append([int(c) for c in input().split()])
ko = set()
for i in range(n):
	for j in range(n):
		if A[i][j] == 1:
			ko.add(i)
		elif A[i][j] == 2:
			ko.add(j)
		elif A[i][j] == 3:
			ko |= {i, j}
ans = [i + 1 for i in range(n) if i not in ko]
print(len(ans))
if ans:
	print(*ans)


n = int(input())
a = []
b = [0 for x in range(n)]
for x in range(n):
	a.append(list(map(int, input().split())))
for x in range(n):
	for y in range(n):
		if x > y:
			if a[x][y] == 1:
				b[x] += 1
			elif a[x][y] == 2:
				b[y] += 1
			elif a[x][y] == 3:
				b[y] += 1
				b[x] += 1
print(b.count(0))
for x in range(n):
	if b[x] == 0:
		print(x + 1, end=' ')


from collections import defaultdict, deque, Counter, OrderedDict
from heapq import heappop, heappush

def main():
	n = int(input())
	arr = [[int(i) for i in input().split()] for i in range(n)]
	ans = []
	for i in range(n):
		if arr[i].count(3) + arr[i].count(1) == 0:
			ans.append(i + 1)
	print(len(ans))
	print(' '.join(map(str, ans)))
main()


def main():
	ans = []
	n = int(input())
	for i in range(1, n + 1):
		vals = list(map(int, input().split()))
		good = 1 not in vals and 3 not in vals
		if good:
			ans.append(str(i))
	print(len(ans))
	print(' '.join(ans))
main()


n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
b = [i + 1 for i in range(n) if all((not x in (1, 3) for x in a[i]))]
print(len(b))
print(' '.join(map(str, b)))


n = int(input())
r = []
for i in range(n):
	collisions = list(map(int, input().split()))
	for collision in collisions:
		if collision in [1, 3]:
			break
	else:
		r.append(i + 1)
print(len(r))
print(' '.join(map(str, r)))


def x():
	k = input().split()
	return True if '1' not in k and '3' not in k else False
r = [i + 1 for i in range(int(input())) if x()]
print(len(r))
print(*r)


n = int(input())
a = [i for i in range(1, n + 1)]
for i in range(1, n + 1):
	arr = list(map(int, input().split()))
	for j in range(n):
		if arr[j] == 1:
			if i in a:
				a.remove(i)
		if arr[j] == 2:
			if j + 1 in a:
				a.remove(j + 1)
		if arr[j] == 3:
			if i in a:
				a.remove(i)
			if j + 1 in a:
				a.remove(j + 1)
print(len(a))
print(' '.join([str(i) for i in a]))


n = int(input().strip())
grid = [input().strip().split() for _ in range(n)]
goodCars = []
for i in range(n):
	if '1' not in grid[i] and '3' not in grid[i]:
		goodCars.append(i + 1)
print(len(goodCars))
print(*goodCars)


n = int(input())
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
se = set()
for i in range(n):
	se.add(i)
for i in range(n):
	for j in range(n):
		if l[i][j] >= 0:
			if l[i][j] == 1:
				if i in se:
					se.remove(i)
			elif l[i][j] == 2:
				if j in se:
					se.remove(j)
			elif l[i][j] == 3:
				if i in se:
					se.remove(i)
				if j in se:
					se.remove(j)
print(len(se))
for i in se:
	print(i + 1, end=' ')


n = int(input())
b = []
total = 0
for i in range(n):
	a = list(map(int, input().split()))
	if 1 not in a and 3 not in a:
		b.append(str(i + 1))
		total += 1
print(total)
if total > 0:
	print(' '.join(b))


n = int(input())
mat = []
for i in range(n):
	mat.append([int(i) for i in input().split()])
vis = [True] * n
l = mat
for i in range(n):
	for j in range(n):
		if l[i][j] == 3:
			vis[i] = False
			vis[j] = False
		if l[i][j] == 1:
			vis[i] = False
		if l[i][j] == 2:
			vis[j] = False
print(sum((i for i in vis)))
for i in range(n):
	if vis[i] == True:
		print(i + 1, end=' ')


n = int(input())
arr = [0] * n
for i in range(n):
	arr[i] = list(map(int, input().split()))
	ans = []
for i in range(n):
	for j in range(n):
		if arr[i][j] == 1 or arr[i][j] == 3:
			break
	else:
		ans.append(i + 1)
print(len(ans))
if len(ans) != 0:
	print(*ans)


def main():
	(n, res) = (int(input()), [])
	for i in range(1, n + 1):
		if all((s in ('0', '2', '-1') for s in input().split())):
			res.append(i)
	print(len(res))
	print(*res)
main()


n = int(input())
col = 0
ans = []
for i in range(n):
	a = list(map(int, input().split()))
	f = True
	for k in range(n):
		if a[k] == 1 or a[k] == 3:
			f = False
			break
	if f:
		col += 1
		ans.append(i + 1)
print(col)
print(*ans)


n = int(input())
a = []
dp = []
for i in range(n):
	a.append(list(map(int, input().split())))
count = 0
for j in range(0, n):
	for i in range(0, n):
		if a[i][j] > 1:
			break
	if a[i][j] <= 1:
		count += 1
		dp.append(j + 1)
print(count)
if count > 0:
	for i in range(0, len(dp)):
		print(dp[i], end=' ')


n = eval(input())
good_cars = []
tot = 0
flag = True
for i in range(n):
	line = [int(x) for x in input().split()]
	for x in line:
		if x in (1, 3):
			flag = False
			break
	if flag:
		tot += 1
		good_cars.append(i + 1)
	flag = True
print(tot)
for car in good_cars:
	print(car, end=' ')
if good_cars != []:
	print()


a = []
for i in range(int(input())):
	c = input().split()
	if '1' not in c and '3' not in c:
		a.append(i + 1)
print(len(a))
print(*a)


n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
ans = []
for i in range(n):
	ok = True
	for x in a[i]:
		if x == 1 or x == 3:
			ok = False
	if ok:
		ans.append(i + 1)
print(len(ans))
print(' '.join(map(str, ans)))


n = int(input())
data = []
for i in range(n):
	temp = [int(x) for x in input().split()]
	data.append(temp)
answer = []
for i in range(n):
	carGood = True
	for j in range(n):
		if data[i][j] == 1 or data[i][j] == 3:
			carGood = False
			break
	if carGood:
		answer.append(str(i + 1))
if len(answer) == 0:
	print(0)
	exit(0)
print(len(answer))
print(' '.join(answer))


(c, l) = (0, [])
for i in range(int(int(input()))):
	d = list(map(int, input().split()))
	if 1 not in d and 3 not in d:
		c = c + 1
		l.append(i + 1)
print(c)
print(*l)


n = int(input())
ans = 0
ansarr = []
for i in range(n):
	s = list(map(int, input().split()))
	if 1 in s or 3 in s:
		kek = 0
	else:
		ans += 1
		ansarr.append(i + 1)
print(ans)
print(' '.join(map(str, ansarr)))


n = int(input())
sl = []
val = [0 for i in range(n)]
for i in range(n):
	sl1 = list(map(int, input().split()))
	for j in range(n):
		if sl1[j] == 0:
			continue
		elif sl1[j] == 1:
			val[i] = 1
		elif sl1[j] == 2:
			val[j] = 1
		elif sl1[j] == 3:
			val[j] = 1
			val[i] = 1
ans = 0
s = ''
for i in range(n):
	if val[i] == 0:
		s += str(i + 1) + ' '
		ans += 1
print(ans)
print(s)


n = int(input())
a = [0] * n
ans = []
for i in range(n):
	cur = set(input().split())
	if not ('3' in cur or '1' in cur):
		ans.append(i + 1)
print(len(ans))
print(*ans)


R = lambda : map(int, input().split())
(n,) = R()
ans = []
for i in range(n):
	s = input().split()
	if '3' not in s and '1' not in s:
		ans += [str(i + 1)]
print(len(ans))
print(' '.join(ans))


import sys
import bisect
t = 1
for _ in range(t):
	n = int(input())
	l = []
	for i in range(n):
		l.append(list(map(int, input().split())))
	ans = [0] * (n + 1)
	for i in range(n):
		for j in range(n):
			if l[i][j] == 1:
				ans[i + 1] = 1
			if l[i][j] == 2:
				ans[j + 1] = 1
			if l[i][j] == 3:
				ans[i + 1] = 1
				ans[j + 1] = 1
	l1 = []
	for i in range(1, n + 1):
		if ans[i] == 0:
			l1.append(i)
	l1.sort()
	print(len(l1))
	print(*l1)


N = int(input())
Ans = list()
for i in range(N):
	X = list(map(int, input().split()))
	if not (3 in X or 1 in X):
		Ans.append(i + 1)
print(len(Ans))
print(*Ans)


n = int(input())
a = []
t = 0
for i in range(n):
	b = [int(i) for i in input().split()]
	if b.count(1) + b.count(3) == 0:
		a.append(i + 1)
		t = t + 1
print(t)
for i in range(t):
	print(a[i], end=' ')


n = int(input())
matrix = []
goodCars = []
for i in range(n):
	row = [int(x) for x in input().split()]
	matrix.append(row)
	goodCars.append(1)
for i in range(n):
	for j in range(n):
		if matrix[i][j] == 1:
			goodCars[i] = 0
		elif matrix[i][j] == 2:
			goodCars[j] = 0
		elif matrix[i][j] == 3:
			goodCars[i] = 0
			goodCars[j] = 0
good = []
for i in range(n):
	if goodCars[i] == 1:
		good.append(i + 1)
print(len(good))
for i in range(len(good)):
	print(good[i], end=' ')


def is_good_cars(result):
	for r in result:
		if r == '1' or r == '3':
			return False
	return True

def main():
	n = int(input())
	results = [input().split() for _ in range(n)]
	good_cars = [i + 1 for i in range(n) if is_good_cars(results[i])]
	print(len(good_cars))
	print(' '.join([str(i) for i in good_cars]))
main()


n = int(input())
l = [0] * n
bad = [0] * n
good = n
for i in range(n):
	val = list(map(int, input().strip().split()))
	for j in range(n):
		a = val[j]
		if a == 1:
			if bad[i] == 0:
				bad[i] = 1
				good -= 1
		elif a == 2:
			if bad[j] == 0:
				bad[j] = 1
				good -= 1
		elif a == 3:
			if bad[i] == 0:
				bad[i] = 1
				good -= 1
			if bad[j] == 0:
				bad[j] = 1
				good -= 1
		elif good == 0:
			break
s = ''
for i in range(n):
	if bad[i] == 0:
		s = s + str(i + 1) + ' '
print(good)
if good != 0:
	print(s)


n = int(input())
ans = []
for i in range(n):
	arr = list(map(int, input().split()))
	if 1 in arr or 3 in arr:
		continue
	else:
		ans.append(i + 1)
print(len(ans))
print(*ans)


import sys
input = []
input_index = 0

def next(type, number=None):

	def next():
		global input, input_index
		while input_index == len(input):
			if sys.stdin:
				input = sys.stdin.readline().split()
				input_index = 0
			else:
				raise Exception()
		input_index += 1
		return input[input_index - 1]
	if number is None:
		result = type(next())
	else:
		result = [type(next()) for _ in range(number)]
	return result
n = next(int)
c = []
for i in range(n):
	for v in next(int, n):
		if v == 1 or v == 3:
			break
	else:
		c.append(str(i + 1))
print(len(c))
if len(c) != 0:
	print(' '.join(c))


n = int(input())
cars = set(range(0, n))
for i in range(0, n):
	line = list(map(int, input().split()))
	for j in range(i + 1, n):
		v = line[j]
		if (v == 1 or v == 3) and i in cars:
			cars.remove(i)
		if (v == 2 or v == 3) and j in cars:
			cars.remove(j)
cars = sorted(list([c + 1 for c in cars]))
print(len(cars))
print(*cars)


t = int(input())
s = [1 for x in range(t)]
for y in range(t):
	l1 = [int(x) for x in input().split()]
	for x in range(len(l1)):
		if l1[x] == 1:
			s[y] = 0
		if l1[x] == 2:
			s[x] = 0
		elif l1[x] == 3:
			s[y] = 0
			s[x] = 0
c_out = []
for x in range(t):
	if s[x]:
		c_out.append(x + 1)
print(len(c_out))
print(*c_out)


n = int(input())
m = [[] for i in range(n)]
for i in range(n):
	m[i] = list(map(int, input().split(' ')))
good = [True] * n
for i in range(n):
	for j in range(n):
		if m[i][j] == 1:
			good[i] = False
		if m[i][j] == 2:
			good[j] = False
		if m[i][j] == 3:
			good[i] = False
			good[j] = False
print(sum((1 for i in good if i == True)))
for i in range(n):
	if good[i]:
		print(i + 1, end=' ')


n = int(input())
A = []
for i in range(n):
	A.append(list(map(int, input().split())))
B = [1] * n
for i in range(n):
	for j in range(n):
		if A[i][j] == 1:
			B[i] = 0
		elif A[i][j] == 2:
			B[j] = 0
		elif A[i][j] == 3:
			B[j] = 0
			B[i] = 0
print(sum(B))
for i in range(n):
	if B[i] > 0:
		print(i + 1, end=' ')


n = int(input())
arr = []
for i in range(n):
	arr.append(list(map(int, input().split())))
cnt = 0
ans = []
for i in range(n):
	f = 0
	for j in range(n):
		if arr[i][j] == 1 or arr[i][j] == 3:
			f = 1
			break
	if f == 0:
		cnt += 1
		ans.append(i + 1)
print(cnt)
print(*ans)


def check(array):
	for elem in array:
		if elem == 1 or elem == 3:
			return False
	return True
n = int(input())
a = [[None for j in range(n)] for i in range(n)]
for i in range(n):
	inp = list(map(int, input().split()))
	for j in range(len(inp)):
		a[i][j] = inp[j]
good = []
for i in range(n):
	if check(a[i]):
		good.append(i + 1)
print(len(good))
for elem in good:
	print(elem, end=' ')


n = int(input())
a = []
for i in range(n):
	l = list(map(int, input().split()))
	a.append(l)
if n == 1:
	print(1)
	print(1)
	exit(0)
good = set()
for i in range(1, n + 1):
	good.add(i)
for i in range(n):
	if 1 in a[i] or 3 in a[i]:
		good.remove(i + 1)
if len(good) == 0:
	print(0)
else:
	print(len(good))
	print(*good)


import sys
lines = []
for Line in sys.stdin:
	lines.append(Line.rstrip('\n'))
n = int(lines[0])
del lines[0]
M = []
for i in range(n):
	M += [list(map(int, lines[i].split()))]
r = []
for i in range(n):
	r1 = False
	r2 = False
	d = [M[j][i] for j in range(n)]
	if 2 not in d and 3 not in d:
		r1 = True
	g = [M[i][j] for j in range(n)]
	if 1 not in g and 3 not in g:
		r2 = True
	if r1 and r2:
		r += [i + 1]
print(len(r))
if len(r) != 0:
	print(*r)


n = int(input())
cars = []
for i in range(n):
	s = list(map(int, input().split()))
	if 1 not in s and 3 not in s:
		cars.append(i + 1)
print(len(cars))
print(' '.join((str(s) for s in cars)))


import math
matrix = []
n = int(input())
for i in range(n):
	a = [int(x) for x in input().split()]
	matrix.append(a)
ans = 0
l = []
for i in range(n):
	count = 0
	for j in range(n):
		if matrix[i][j] == 0 or matrix[i][j] == 2:
			count += 1
	if count == n - 1:
		ans += 1
		l.append(i + 1)
print(ans)
print(*l)


import sys
n = int(input())
ans = []
for i in range(n):
	a = set(map(int, sys.stdin.readline().split()))
	if 1 in a or 3 in a:
		continue
	else:
		ans.append(str(i + 1))
print(len(ans))
if ans:
	print(' '.join(ans))


n = int(input())
l = []
for i in range(n):
	a = [int(i) for i in input().split()]
	if 1 in a or 3 in a:
		pass
	else:
		l.append(i + 1)
print(len(l))
print(*l)


n = int(input())
cars = [i for i in range(n)]
for c in range(n):
	cars[c] = True
for i in range(n):
	numbers = input().split(' ')
	for j in range(n):
		if i == j:
			continue
		elif numbers[j] == '1':
			cars[i] = False
		elif numbers[j] == '2':
			cars[j] = False
		elif numbers[j] == '3':
			cars[j] = False
			cars[i] = False
good_cars_n = 0
good_cars_list = []
for i in range(n):
	if cars[i] == True:
		good_cars_n += 1
		good_cars_list.append(i)
print(good_cars_n)
if good_cars_n != 0:
	for value in good_cars_list:
		print(value + 1, end=' ')
	print()


def single_integer():
	return int(input())

def multi_integer():
	return map(int, input().split())

def string():
	return input()

def multi_string():
	return input().split()
n = single_integer()
ans = 0
cars = list()
for i in range(n):
	for j in multi_string():
		if j == '1' or j == '3':
			break
	else:
		ans += 1
		cars.append(i + 1)
print(ans)
print(*cars)


n = int(input())
ar = []
for i in range(n):
	ar.append(list(map(int, input().split())))
ans = [0] * n
for i in range(n):
	for j in range(n):
		if ar[i][j] == 1 or ar[i][j] == 3:
			ans[i] = 1
		if ar[i][j] == 2:
			ans[j] = 1
ans1 = []
for i in range(n):
	if ans[i] == 0:
		ans1.append(i + 1)
print(len(ans1))
for i in range(len(ans1)):
	print(ans1[i], end=' ')


n = int(input())
ans = []
for i in range(n):
	s = list(map(int, input().split()))
	count1 = 0
	countIn1 = 0
	for j in s:
		if j == 1 or j == 3:
			count1 += 1
		if j == -1:
			countIn1 += 1
	if count1 == 0 and countIn1 == 1:
		ans.append(i + 1)
print(len(ans))
print(*ans)


import math
import sys
n = int(input())
ans = 0
c = []
for i in range(0, n):
	m = 0
	l = list(map(int, input().split()))
	for j in l:
		if j == 2 or j == 0:
			m += 1
	if m == n - 1:
		ans += 1
		c.append(i)
print(ans)
for j in c:
	print(j + 1, end=' ')
if c != []:
	print()


a = int(input())
ans = []
cnt = 0
for i in range(a):
	mas = list(map(int, input().split()))
	if 1 in mas or 3 in mas:
		continue
	else:
		cnt += 1
		ans.append(i + 1)
print(cnt)
print(*ans)


n = int(input())
cars = []
win = [i for i in range(1, n + 1)]
for i in range(n):
	cars.append([int(j) for j in input().split()])
for i in range(n):
	for j in range(n):
		if cars[i][j] == -1:
			pass
		elif cars[i][j] == 1 or cars[i][j] == 3:
			try:
				win.remove(i + 1)
			except:
				pass
print(len(win))
for i in win:
	print(i, end=' ')


n = int(input())
data = []
for _ in range(n):
	data.append(list(map(int, input().split())))
res = []
for i in range(n):
	good = True
	for j in range(n):
		if i != j and data[i][j] not in [0, 2]:
			good = False
			break
	if good:
		res.append(i)
print(len(res))
for r in res:
	print(r + 1, end=' ')


n = int(input())
good_cars = []
for i in range(n):
	hit_statuses = [int(x) for x in input().split()]
	if 1 not in hit_statuses and 3 not in hit_statuses:
		good_cars.append(str(i + 1))
print(len(good_cars))
print(' '.join(good_cars))


def solution(n, a):
	x = set()
	for i in range(1, n):
		for j in range(0, i):
			if a[i][j] == 1:
				x.add(i)
			elif a[i][j] == 2:
				x.add(j)
			elif a[i][j] == 3:
				x.add(i)
				x.add(j)
			else:
				continue
	print(n - len(x))
	for i in range(n):
		if i not in x:
			print(i + 1, end=' ')
			d = 1
n = int(input(''))
a = []
for i in range(n):
	b = list(map(int, input('').split()))
	a.append(b)
solution(n, a)


n = int(input())
ans = 0
l_ans = []
for i in range(n):
	l = list(input().split())
	if not l.count('1') and (not l.count('3')):
		ans += 1
		l_ans.append(i + 1)
print(ans)
if l_ans:
	print(*l_ans)


n = int(input())
b = []
for i in range(n):
	b.append(list(map(int, input().split())))
l = []
for i in range(n):
	l.append(i)
for i in range(n):
	for j in range(n):
		if b[i][j] == 1 and i in l:
			l.remove(i)
		elif b[i][j] == 2 and j in l:
			l.remove(j)
		elif b[i][j] == 3:
			if i in l:
				l.remove(i)
			if j in l:
				l.remove(j)
print(len(l))
for i in l:
	print(i + 1, end=' ')


a = int(input())
b = set([0, -1, 2])
c = []
for i in range(a):
	d = set(map(int, input().split()))
	if d <= b:
		c += [i + 1]
print(len(c))
if c:
	print(' '.join(map(str, c)))


n = int(input())
c = [True for x in range(n)]
for i in range(n):
	r = [int(x) for x in input().split()]
	for j in range(n):
		if j != i:
			if r[j] == 1:
				c[i] = False
			if r[j] == 2:
				c[j] = False
			if r[j] == 3:
				c[j] = False
				c[i] = False
ans = []
for i in range(n):
	if c[i]:
		ans.append(str(i + 1))
print(len(ans))
if ans:
	print(' '.join(ans))


import itertools as ittls
from collections import Counter
import re

def inputarray(func=int):
	return map(func, input().split())
N = int(input())
mask = [1] * N
for i in range(N):
	A = inputarray()
	for (j, v) in enumerate(A):
		if v == 1 or v == 3:
			mask[i] = 0
		if v == 2 or v == 3:
			mask[j] = 0
res = list(map(lambda x: str(x[0] + 1), filter(lambda x: x[1] == 1, enumerate(mask))))
print(len(res))
print(' '.join(res))


good_cars = [i for i in range(1, int(input()) + 1) if set(input().split()).issubset({'-1', '0', '2'})]
print(len(good_cars))
print(*good_cars)


def toy_cars(lst, n):
	a = [0] * n
	result = 0
	for i in range(n):
		count = 0
		for j in range(n):
			if lst[i][j] == 3 or lst[i][j] == 1:
				count += 1
		if count == 0:
			a[result] = i + 1
			result += 1
	return (result, a[0:result])
N = int(input())
b = list()
for x in range(N):
	c = [int(j) for j in input().split()]
	b.append(list(c))
m = toy_cars(b, N)
print(m[0])
print(*m[1])


n = int(input())
res = list()
for i in range(0, n):
	num = map(int, input().split())
	if all(map(lambda x: x != 1 and x != 3, num)):
		res.append(i + 1)
print(len(res))
if len(res) != 0:
	print(*res)


n = int(input())
l_c = list()
l_g = list()
for i in range(n):
	l_c.append(list(map(int, input().split())))
for i in range(n):
	f = True
	for j in range(n):
		if l_c[i][j] == 1 or l_c[i][j] == 3:
			f = False
			break
	if f:
		l_g.append(str(i + 1))
print(len(l_g))
print(' '.join(l_g))


n = int(input())
goodcars = 0
res = []
for i in range(n):
	a = list(map(int, input().split()))
	accept = 0
	for j in range(n):
		if a[j] == 1 or a[j] == 3:
			accept = 1
			break
	if accept == 0:
		goodcars += 1
		res.append(i + 1)
print(goodcars)
print(*res)


__author__ = 'artyom'

def main():
	(n, a) = (read(), [])
	for _ in range(n):
		a.append(read(3))
	ans = n
	for i in range(n):
		for j in range(n):
			if a[i][j] == 1 or a[i][j] == 3:
				a[i][i] = 0
				ans -= 1
				break
	s = str(ans) + '\n'
	for i in range(n):
		if a[i][i]:
			s += str(i + 1) + ' '
	return s

def read(mode=2):
	inputs = input().strip()
	if mode == 0:
		return inputs
	if mode == 1:
		return inputs.split()
	if mode == 2:
		return int(inputs)
	if mode == 3:
		return list(map(int, inputs.split()))

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='')
write(main())


n = int(input())
matrix = [list(map(int, input().split())) for i in range(n)]
answer = []
for i in range(n):
	if matrix[i].count(1) == 0 and matrix[i].count(3) == 0:
		answer.append(i + 1)
print(len(answer))
if len(answer) > 0:
	print(' '.join(map(str, answer)))


n = int(input())
a = []
result = []
for i in range(n):
	s = input().split()
	if not ('1' in s or '3' in s):
		result.append(i + 1)
print(len(result))
for i in result:
	print(i, end=' ')


n = int(input())
s = []
for i in range(n):
	for k in input().split():
		t = 0
		if int(k) == 1 or int(k) == 3:
			t = 1
			break
	if not t:
		s.append(i + 1)
print(len(s))
print(*s)


n = int(input())
i = 0
j = 0
b = []
while i < n:
	a = set(input().split())
	if '1' not in a and '3' not in a:
		j += 1
		b.append(str(i + 1))
	i += 1
print(j)
print(' '.join(b))


n = int(input())
M = []
for i in range(n):
	M += [list(map(int, input().split()))]
an = []
for i in range(n):
	v = True
	for j in range(n):
		if M[i][j] == 1 or M[i][j] == 3:
			v = False
			break
	if v:
		an += [i + 1]
print(len(an))
for a in an:
	print(a, end=' ')


s = int(input())
cars = [x for x in range(s)]
lislist = []
for i in range(s):
	row = list(map(int, input().split()))
	lislist.append(row)
for i in range(s):
	for j in range(s):
		if lislist[i][j] == 1 or lislist[i][j] == 3:
			if i in cars:
				cars.remove(i)
		if lislist[i][j] == 2 or lislist[i][j] == 3:
			if j in cars:
				cars.remove(j)
print(len(cars))
if len(cars) != 0:
	for i in cars:
		print(i + 1, end=' ')
	print()


n = int(input())
count = 0
cars = []
for i in range(n):
	a = list(map(int, input().split()))
	if 1 not in a and 3 not in a:
		count += 1
		cars.append(str(i + 1))
print(count)
print(' '.join(cars))


n = int(input())
q = 0
k = 0
r = []
for j in range(n):
	m = list(map(int, input().split()))
	for i in range(n):
		if m[i] == 1 or m[i] == 3:
			k = 1
			break
	if k == 0:
		q += 1
		r.append(j + 1)
	k = 0
print(q)
print(' '.join(map(str, r)))


n = int(input())
m = []
board = {}
for i in range(n):
	m.append(input().split())
	board[i] = 0
for i in range(n):
	for j in range(n):
		if m[i][j] == '3' or m[i][j] == '1':
			board[i] += 1
count = 0
indexes = []
for i in range(n):
	if board[i] == 0:
		count += 1
		indexes.append(str(i + 1))
print(count)
print(' '.join(indexes))


n = int(input())
k = 0
b = []
for i in range(n):
	s = input().replace('-1', '4')
	if s.find('3') == -1 and s.find('1') == -1:
		k += 1
		b.append(i + 1)
print(k)
if k > 0:
	z = ''
	for x in b:
		z += str(x) + ' '
	print(z)


def arr_inp():
	return [int(x) for x in input().split()]

def print_arr(arr):
	print(*arr, sep=' ')
(sum, good) = (0, [])
n = int(input())
for i in range(n):
	a = arr_inp()
	if 1 not in a and 3 not in a:
		sum += 1
		good.append(i + 1)
print(sum)
if sum != 0:
	print_arr(good)


x = int(input())
L = []
ANS = []
count = 0
for i in range(x):
	l = list(map(int, input().split()))
	L.append(l)
for j in range(x):
	if 1 not in L[j] and 3 not in L[j]:
		ANS.append(j + 1)
		count = count + 1
print(count)
for k in range(len(ANS)):
	print(ANS[k], end=' ')


n = int(input())
res = []
for car_num in range(1, n + 1):
	temp = [int(i) for i in input().split()]
	for j in range(n):
		if temp[j] in (1, 3):
			break
	else:
		res.append(car_num)
print(len(res))
print(*res)


n = int(input())
l = []
for i in range(n):
	a = input().split()
	l.append(a)
m = []
for i in range(n):
	for j in range(n):
		if l[i][j] == '3' or l[i][j] == '1':
			m.append(i + 1)
			break
print(n - len(m))
for i in range(1, n + 1):
	if i not in m:
		print(i, end=' ')


N = int(input())
table = [list(map(int, input().split())) for _ in range(N)]
ans = [True for i in range(N)]
for i in range(N):
	for j in range(N):
		if table[i][j] == -1 or table[i][j] == 0:
			continue
		elif table[i][j] == 1:
			ans[i] = False
		elif table[i][j] == 2:
			ans[j] = False
		else:
			ans[i] = False
			ans[j] = False
nans = sum([1 for a in ans if a])
print(nans)
if nans == 0:
	exit()
print(' '.join(map(str, [i + 1 for (i, a) in enumerate(ans) if a])))


N = int(input(''))
grid = [[] for i in range(N)]
for i in range(N):
	l = [int(i) for i in input('').split()]
	grid[i] = l
good = []
count = 1
for row in grid:
	if 1 not in row and 3 not in row:
		good.append(count)
	count += 1
print(len(good))
output = ''
for i in good:
	output += str(i) + ' '
print(output.rstrip())


n = int(input())
ans = []
for i in range(n):
	arr = input().split(' ')
	good = True
	for j in arr:
		if j == '1' or j == '3':
			good = False
			break
	if good:
		ans.append(i + 1)
print(ans.__len__())
print(*ans)