N, K = list(map(int, input().split()))

d = []

A = []

for i in range(K):

    d.append(int(eval(input())))

    A.append(list(map(int, input().split())))



hito = [i for i in range(1, N+1)]





for i in range(N):

    name = hito[i]

    for j in range(K):

        if name in A[j]:

            hito[i] = -1

            break



ans = set(hito)

print((len(ans)-1))

N, K = list(map(int, input().split()))

d = []

A = []

for i in range(K):

    d.append(int(eval(input())))

    st = list(map(int, input().split()))

    for j in st:

        A.append(j)



print((N-len(set(A))))
N, K = list(map(int, input().split()))
d = []
A = []
for i in range(K):
    d.append(int(eval(input())))
    A.append(list(map(int, input().split())))
hito = [i for i in range(1, N + 1)]
for i in range(N):
    name = hito[i]
    for j in range(K):
        if name in A[j]:
            hito[i] = -1
            break
ans = set(hito)
print((len(ans) - 1))

N, K = list(map(int, input().split()))
d = []
A = []
for i in range(K):
    d.append(int(eval(input())))
    st = list(map(int, input().split()))
    for j in st:
        A.append(j)
print((N - len(set(A))))

-    A.append(list(map(int, input().split()))) -hito = [i for i in range(1, N + 1)] -for i in range(N): -    name = hito[i] -    for j in range(K): -        if name in A[j]: -            hito[i] = -1 -            break -ans = set(hito) -print((len(ans) - 1)) +    st = list(map(int, input().split())) +    for j in st: +        A.append(j) +print((N - len(set(A))))