#pragma warning(disable:4786) #pragma warning(disable:4996) #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define MEM(a, b) memset(a, (b), sizeof(a)) #define CLR(a) memset(a, 0, sizeof(a)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) ) #define S(X) ( (X) * (X) ) #define SZ(V) (int )V.size() #define FORN(i, n) for(i = 0; i < n; i++) #define FORAB(i, a, b) for(i = a; i <= b; i++) #define ALL(V) V.begin(), V.end() #define IN(A, B, C) ((B) <= (A) && (A) <= (C)) typedef pair PII; typedef pair PDD; typedef vector VI; typedef vector VP; #define AIN(A, B, C) assert(IN(A, B, C)) //typedef int LL; //typedef long long int LL; //typedef __int64 LL; bitset<20004> offer[21]; int m, ans; void bktk(int at, int taken) { if(at == m) { ans = MAX(ans, taken); return; } if(ans >= taken + m - at) return; bktk(at + 1, taken); if((offer[20] & offer[at]).count()) return; offer[20] ^= offer[at]; bktk(at + 1, taken + 1); offer[20] ^= offer[at]; } int main() { int i, j, k, a, n; scanf("%d %d", &n, &m); FORN(i, m) { scanf("%d", &k); FORN(j, k) { scanf("%d", &a); offer[i].set(a); } } bktk(0, 0); printf("%d\n", ans); return 0; }