#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> kmp(const string& s) {
  int n = s.size();
  vector<int> res(n);
  for (int i = 1, k = 0; i < n; ++i) {
    while (k && s[k] != s[i]) {
      k = res[k - 1];
    }
    if (s[k] == s[i]) {
      ++k;
    }
    res[i] = k;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  int m;
  cin >> m;
  int cx = 0;
  for (int i = 0; i < m; ++i) {
    string word;
    cin >> word;
    int sz = word.size();
    if (sz == 1) {
      continue;
    }
    vector<int> first(sz + 1, -1), last(sz + 1, -1);
    auto pref = kmp(word);
    int matched = 0;
    for (int j = 0; j < n; ++j) {
      while (matched && word[matched] != s[j]) {
        matched = pref[matched - 1];
      }
      if (s[j] == word[matched]) {
        ++matched;
      }
      if (matched == word.size()) {
        break;
      }
      if (first[matched] == -1) {
        first[matched] = j;
      }
    }
    reverse(word.begin(), word.end());
    auto suf = kmp(word);
    matched = 0;
    for (int j = n - 1; j >= 0; --j) {
      while (matched && word[matched] != s[j]) {
        matched = suf[matched - 1];
      }
      if (word[matched] == s[j]) {
        ++matched;
      }
      if (matched == word.size()) {
        break;
      }
      if (last[matched] == -1) {
        last[matched] = j;
      }
    }
    for (int l = 1; l < sz; ++l) {
      if (first[l] != -1 && last[sz - l] != -1 && first[l] < last[sz - l]) {
        ++cx;
        break;
      }
    }
  }
  cout << cx << '\n';
  return 0;
}
