#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
//max=({});
//条件式が真ならwhileの中身を回し続ける

int g[15][15];
bool flag[1050000];
const int INF = 1001001001;
const int di[] = { -1,0,1,0 };
const int dj[] = { 0,-1,0,1 };

int main() {
	int n, m;
	cin >> n >> m;
	vector<int>a(n);
	int ans = 0;
	rep(i, m) {
		int k;
		cin >> k;
		rep(j, k) {
			int s;
			cin >> s;
			s--;
			a[s] |= 1 << i;
		}
		for (int s = 0;s < (1 << n);s++) {
			int t = 0;
			rep(i, n) {
				if (s >> i & 1) {
					t ^= a[i];
				}
			}
			if (t == p)ans++;
		}
	}
	cout << ans << endl;
	return 0;
}
