#include <bits/stdc++.h>
using namespace std;
int a[1005][1005], n, m, x;
string s;
vector<int> v;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j) {
        continue;
      }
      if (a[i][j] == 1 || a[i][j] == 3) {
        m++;
        break;
      }
    }
    if (m > 0) {
      m = 0;
    } else {
      x++;
      v.push_back(i);
    }
  }
  cout << x << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
}
