#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, q, i, j = 1;
  cin >> n;
  long long cnt = 0;
  bool a[n + 1];
  for (i = 0; i < n + 1; i++) a[i] = true;
  n = n * n;
  for (i = 1; i <= n; i++) {
    cin >> q;
    if (q == 1 || q == 3) {
      a[j] = false;
    }
    if (i % (long long)(sqrt(n)) == 0) j++;
  }
  for (i = 1; i <= sqrt(n); i++) {
    if (a[i]) cnt++;
  }
  cout << cnt << endl;
  for (i = 1; i <= sqrt(n); i++) {
    if (a[i]) cout << i << " ";
  }
  return 0;
}
