#include <bits/stdc++.h>
int main(void) {
  int n, m, i, j, k;
  char s[10][10];
  memset(s, 0, sizeof(s));
  scanf("%d%d", &n, &m);
  for (i = 0; i < m; i++) {
    scanf("%d", &k);
    for (j = 0; j < k; j++) {
      int S;
      scanf("%d", &S);
      s[i][S - 1] = 1;
    }
  }
  int ans = 0;
  int l = (1 << n);
  for (i = 0; i < l; i++) {
    char f = 1;
    for (j = 0; j < m; j++) {
      int g = 0;
      for (k = 0; k < n; k++) {
        if (s[j][k] != 0) g++;
      }
      if (g % 2 == 0) {
        f = 0;
        break;
      }
    }
    if (f != 0) ans++;
  }
  printf("%d\n", ans);
}
