#include<stdio.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iostream>
using namespace std;
int link[505];
bool vis[505];
vector<int> G[505];
bool dfs(int x)
{
for(int i = 0;i < G[x].size();i++)
{
int p = G[x][i];
if(!vis[p])
{
vis[p] = true;
if(link[p]==-1||dfs(link[p]))
{
link[p] = x;
return true;
}
}
}
return false;
}
int main()
{
int n,a,m,b;
while(scanf("%d",&n)!=EOF)
{
memset(G,0,sizeof(G));
for(int i = 0;i < n;i++)
{
scanf("%d: (%d)",&a,&m);
for(int j = 0;j < m;j++)
{
scanf(" %d",&b);
G[a].push_back(b);
}
}
int count = 0;
memset(link,-1,sizeof(link));
for(int i = 0;i < n;i++)
{
memset(vis,false,sizeof(vis));
if(dfs(i)) count++;
}
printf("%d\n",n-count/2);
}
}