#include <bits/stdc++.h>
using namespace std;
const int N = 101005;
int p[N];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  int n = s.length();
  int m;
  cin >> m;
  int ans = 0;
  string s1 = s;
  reverse((s1).begin(), (s1).end());
  for (int i = 0; i < m; i++) {
    string t;
    cin >> t;
    int l = t.length(), pref[l + 1], suf[l + 1];
    memset(pref, -1, sizeof(pref));
    memset(suf, -1, sizeof(suf));
    string str = t + '#' + s;
    for (int i = 1; i < str.length(); i++) {
      int j = p[i - 1];
      while (j && str[i] != str[j]) {
        j = p[j - 1];
      }
      if (str[i] == str[j]) j++;
      p[i] = j;
      if (i > l && pref[j] == -1) {
        pref[j] = i - l - j;
      }
    }
    reverse((t).begin(), (t).end());
    str = t + '#' + s1;
    for (int i = 1; i < str.length(); i++) {
      int j = p[i - 1];
      while (j && str[i] != str[j]) {
        j = p[j - 1];
      }
      if (str[i] == str[j]) j++;
      p[i] = j;
      if (i > l && suf[j] == -1) {
        suf[j] = n - (i - l - j) - 1 - j + 1;
      }
    }
    for (int i = 1; i < l; i++) {
      if (pref[i] != -1 && suf[l - i] != -1) {
        if (pref[i] + i <= suf[l - i]) {
          ans++;
          break;
        }
      }
    }
  }
  cout << ans;
}
