#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>

using namespace std;

void C_128()
{
  int N, M;
  cin >> N >> M;

  vector< vector<int> > light(M);
  for (int i = 0; i < M; ++i)
  {
    int k;
    cin >> k;
    light[i].resize(k);

    for (int j = 0; j < k; ++j)
    {
      cin >> light[i][j];
      --light[i][j];
    }
  }

  vector<int> p(M);
  for (int i = 0; i < M; ++i) cin >> p[i];

  int ans = 0;
  for (int i = 0; i < (1 << N); ++i)
  {
    bool ok = true;
    for (int j = 0; j < M; ++j)
    {
      
      int c = 0;
      for (int id : light[j])
      {
        if ((i >> id) & 1) ++c;
      }
      c %= 2;
      if (c != p[j]) ok = false;
    }

    if (ok == true) ++ans;
  }
  cout << ans << endl;
}
