#include <bits/stdc++.h>
int main() {
  int N;
  scanf("%d", &N);
  int ar[N][N], i, j, flag, res = 0, index[N], k;
  for (i = 0; i < N; i++) {
    for (j = 0; j < N; j++) {
      scanf("%d ", &ar[i][j]);
    }
  }
  k = 0;
  for (i = 0; i < N; i++) {
    flag = 0;
    for (j = 0; j < N; j++) {
      if (i == j) continue;
      if (ar[i][j] == 1 || ar[i][j] == 3) {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      res++;
      index[k++] = i;
    }
  }
  printf("%d\n", res);
  for (i = 0; i < res; i++) printf("%d ", index[i] + 1);
  return 0;
}
