#include <fstream>
#include <string>
#include <cstring>
#include <unordered_set>
using namespace std;
ifstream in("abc2.in");
ofstream out("abc2.out");
int cnt, n, len, ans;
char ch[10000001];
string cuv;
unordered_set<string> dictionary;
int main()
{
in >> ch;
while(!in.eof())
in >> cuv, dictionary.insert(cuv);
n = cuv.length();
len = strlen(ch);
for(int i = 0; i < len - n + 1; i++)
{
char temp[21] = {'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'};
for(int j = 0; j < n; j++)
temp[j] = ch[i+j];
string str(temp);
ans += (dictionary.find(str) != dictionary.end());
}
out << ans;
return 0;
}