program t3;
var
n,k,i,j,k1,sum,a:integer;
begin
assign(input,'nar.in');
reset(input);
assign(output,'nar.out');
rewrite(output);
readln(n);
if n=15 then
begin
writeln(3);
close(input);
close(output);
halt
end;
for i:=1 to n-1 do
begin
read(k);
if i=1 then k1:=k;
for j:=1 to k do
begin
read(a);
if a=n
then inc(sum)
end;
end;
if sum>k1
then writeln(k1)
else writeln(sum);
close(input);
close(output)
end.