#include <iostream> #include <memory.h> #include <cstdio> using namespace std; int c; const int maxn=502; int visit[maxn],map[maxn][maxn],link[maxn]; bool DFS(int a) { for(int i=0;i<c;i++) { if(!visit[i] && map[a][i]) { visit[i]=1; if(link[i]==-1 || DFS(link[i])) { link[i]=a; return true; } } } return false; } int main() { // freopen("in.txt","r",stdin); int x,y,tmp; while(cin >> c) { memset(map,0,sizeof(map)); memset(link,-1,sizeof(link)); for(int i=0;i<c;i++) { scanf("%d: (%d)",&x,&y); for(int j=0;j<y;j++) { scanf("%d",&tmp); map[i][tmp]=1; } } int sum=0; for(int i=0;i<c;i++) { memset(visit,0,sizeof(visit)); if(DFS(i))sum++; } cout << c-sum/2 <<endl; } return 0; }