#include <bits/stdc++.h>
using namespace std;
int main() {
  short n;
  cin >> n;
  short a[n][n];
  bool flag[n];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> a[i][j];
  for (int i = 0; i < n; i++) flag[i] = true;
  int p = n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (i != j) switch (a[i][j]) {
          case 1: {
            if (flag[i]) {
              flag[i] = false;
              --p;
            }
            break;
          }
          case 2: {
            if (flag[j]) {
              flag[j] = false;
              --p;
            }
            break;
          }
          case 3: {
            if (flag[i]) {
              flag[i] = false;
              --p;
            }
            if (flag[j]) {
              flag[j] = false;
              --p;
            }
            break;
          }
        }
  cout << p << endl;
  for (int i = 0; i < n; i++)
    if (flag[i]) cout << i + 1 << " ";
  return 0;
}
