{$apptype console}
uses SysUtils;
var
	a : array[1..1000] of string;
	s : string;
	i, n, ans : integer;
	ch : char;
begin
	reset(input, 'constant.in');
	rewrite(output, 'constant.out');
	readln(n);
	for i := 1 to n do begin
		a[i] := '';
		while (not SeekEoln) do begin
			read(ch);
			if (ch <> ' ') then begin
				a[i] := a[i] + ch;
			end;
		end;
		readln;
	end;
	read(s);
	ans := 0;
	for i := 1 to n do begin
		if (a[i] = s) then inc(ans);
	end;
	writeln(ans);
end.