#include <bits/stdc++.h>
#pragma GCC optimise("ofast")
#pragma GCC optimise("unroll-loops")
using namespace std;
const int N = 200000 + 10;
const long long MOD = 1000000000 + 7;
const long long INF = 1000000000000000000;
const long long LOG = 25;
string s, second[N];
long long n, ans, pref[1010], suf[1010], f[1010];
bool solve(string a, string b) {
  memset(pref, 63, sizeof pref);
  memset(suf, 63, sizeof suf);
  memset(f, 0, sizeof f);
  int cur = 0;
  for (int i = 1; i < a.size(); i++) {
    while (cur > 0 && a[cur] != a[i]) cur = f[cur];
    if (a[i] == a[cur]) cur++;
    f[i + 1] = cur;
  }
  cur = 0;
  for (int i = 0; i < b.size(); i++) {
    while (cur > 0 && a[cur] != b[i]) cur = f[cur];
    if (a[cur] == b[i]) cur++;
    pref[cur] = min(pref[cur], (long long)i);
    if (cur == a.size()) cur = f[cur];
  }
  for (int i = 1008; i >= 0; i--) {
    pref[i] = min(pref[i], pref[i + 1] - 1);
  }
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  memset(f, 0, sizeof f);
  cur = 0;
  for (int i = 1; i < a.size(); i++) {
    while (cur > 0 && a[cur] != a[i]) cur = f[cur];
    if (a[i] == a[cur]) cur++;
    f[i + 1] = cur;
  }
  cur = 0;
  for (int i = 0; i < b.size(); i++) {
    while (cur > 0 && a[cur] != b[i]) cur = f[cur];
    if (a[cur] == b[i]) cur++;
    suf[cur] = min(suf[cur], (long long)i);
    if (cur == a.size()) cur = f[cur];
  }
  for (int i = 1008; i >= 0; i--) {
    suf[i] = min(suf[i], suf[i + 1] - 1);
  }
  for (int i = 1; i < a.size(); i++) {
    if (pref[i] < b.size() - suf[a.size() - i] - 1) return 1;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> second[i];
    ans += solve(second[i], s);
  }
  cout << ans;
  return 0;
}
