#include <bits/stdc++.h>
using namespace std;
int n, t, pi[1003], pref[1003], suf[1003], si[1003], temp, res, l;
string s, z;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> z;
    memset(suf, 0, sizeof(suf));
    memset(pi, 0, sizeof(pi));
    memset(si, 0, sizeof(si));
    l = 0;
    temp = 0;
    pref[0] = -1;
    for (int j = 1; j < z.size(); j++) {
      pref[j] = s.size();
      while (l != 0 && z[l] != z[j]) {
        l = pi[l - 1];
      }
      if (z[l] == z[j]) {
        l++;
        pi[j] = l;
      } else {
        pi[j] = 0;
      }
    }
    pref[z.size()] = s.size();
    l = 0;
    for (int j = 0; j < s.size(); j++) {
      if (l == z.size()) break;
      while (l != 0 && z[l] != s[j]) {
        l = pi[l - 1];
      }
      if (z[l] == s[j]) {
        l++;
      }
      if (pref[l] == s.size() && l != 0) pref[l] = j - l + 1;
    }
    reverse(s.begin(), s.end());
    reverse(z.begin(), z.end());
    l = 0;
    for (int j = 1; j < z.size(); j++) {
      while (l != 0 && z[l] != z[j]) {
        l = si[l - 1];
      }
      if (z[l] == z[j]) {
        l++;
        si[j] = l;
      } else {
        si[j] = 0;
      }
    }
    l = 0;
    suf[0] = s.size() + 1;
    for (int j = 0; j < s.size(); j++) {
      if (l == z.size()) break;
      while (l != 0 && z[l] != s[j]) {
        l = si[l - 1];
      }
      if (z[l] == s[j]) {
        l++;
      }
      if (suf[l] == 0 && l != 0) suf[l] = s.size() - j - 2 + l;
    }
    for (int j = 0; j <= z.size(); j++) {
      if (suf[z.size() - j] - pref[j] >= (int)z.size() - 1) temp = 1;
    }
    if (temp == 1 && z.size() > 1) {
      res++;
    }
    reverse(s.begin(), s.end());
  }
  cout << res << endl;
}
