#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  map<int, int> m;
  cin >> n;
  set<int> s;
  set<int>::iterator it;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      int x;
      cin >> x;
      if (x != 0) {
        s.insert(i);
        s.insert(j);
        if (x == 1) {
          m[i] = 1;
        } else if (x == 2) {
          m[j] = 1;
        } else if (x == 3) {
          m[i] = 1;
          m[j] = 1;
        }
      }
    }
  }
  int cnt = 0;
  vector<int> v;
  for (it = s.begin(); it != s.end(); it++) {
    if (!m[*it]) {
      cnt++;
      v.push_back(*it);
    }
  }
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++) {
    cout << v[i];
    if (i < cnt - 1) {
      cout << " ";
    }
  }
  if (cnt > 0) {
    cout << endl;
  }
  return 0;
}
