program nar;
const
maxn=5000;
type
rec=record
ch:array[0..maxn]of integer;
end;
var
ans,n,i,j:longint;
tree:array[1..maxn]of rec;
v:array[1..maxn,1..maxn]of boolean;
flg:boolean;
procedure init;
begin
assign(input,'nar.in');
reset(input);
assign(output,'nar.out');
rewrite(output);
readln(n);
for i:=1 to n do tree[i].ch[0]:=0;
for i:=2 to n do
begin
read(tree[i-1].ch[0]);
for j:=1 to tree[i-1].ch[0] do
read(tree[i-1].ch[j]);
readln;
end;
fillchar(v,sizeof(v),0);
end;
procedure closef;
begin
close(input);
close(output);
end;
procedure bl(x:integer);
var
i:integer;
begin
if tree[x].ch[0]=0 then
begin
inc(ans);
flg:=true;
end;
if flg then exit;
for i:=1 to tree[x].ch[0] do
if not(v[x,tree[x].ch[i]]) then
begin
v[x,tree[x].ch[i]]:=true;
bl(tree[x].ch[i]);
end;
end;
procedure main;
var
i:integer;
begin
ans:=0;
for i:=1 to tree[1].ch[0] do
begin
flg:=false;
bl(tree[1].ch[i]);
end;
writeln(ans);
end;
begin
init;
main;
closef;
end.