import std.stdio, std.string, std.conv;
import std.algorithm;

void main() {
	auto input = getStdin!(string[]);
	string needle = input[0].toLower;
	string[] haystack = input[1..$-1].join(" ").replace(".", "").replace(",", "").toLower.split(" ");

	auto count = haystack.count(needle);
	count.writeln;
}

T getStdin(T)() {
    string[] cmd;
    string line;
    while ((line = chomp(stdin.readln())) != "") cmd ~= line;
    return to!(T)(cmd);
}