#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > v;
int a[1000][1000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  int cnt = 0;
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a[i][j] == 1) {
        m[i] = 1;
      }
      if (a[i][j] == 2) {
        m[j] = 1;
      } else if (a[i][j] == 3) {
        m[i] = 1;
        m[j] = 1;
      }
    }
  }
  cout << n - m.size() << endl;
  int mark[10000] = {};
  map<int, int>::iterator it = m.begin();
  while (it != m.end()) {
    mark[it->first] = 1;
    it++;
  }
  for (int i = 0; i < n; i++) {
    if (mark[i] == 0) cout << i + 1 << " ";
  }
  cout << endl;
  return 0;
}
