#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int n,h[1505],e[1505],ne[1505],idx,f[1505][2];
bool st[1505];
void add(int a,int b){e[idx]=b,ne[idx]=h[a],h[a]=idx++;}
void dfs(int u){
int i,j;
f[u][0]=0,f[u][1]=1;
for(i=h[u];~i;i=ne[i])j=e[i],dfs(j),f[u][0]+=f[j][1],f[u][1]+=min(f[j][0],f[j][1]);
}
int main()
{
while(cin>>n){
memset(h,-1,sizeof h);
idx=0;
int i,id,cnt,ver,root=0;
memset(st,0,sizeof st);
for(i=0;i<n;i++){
scanf("%d:(%d)",&id,&cnt);
while(cnt--){
scanf("%d",&ver);
add(id,ver);
st[ver]=true;
}
}
while(st[root])root++;
dfs(root);
printf("%d\n", min(f[root][0],f[root][1]));
}
return 0;
}