#include <bits/stdc++.h>
using namespace std;
using ll = long long;
inline int read();
const int M = 100016, MOD = 1000000007;
char tex[M], pat[M];
int fail[M], pref[M], suff[M];
void make_fail() {
  for (int i = 1, j = 0; pat[i]; ++i) {
    while (j && pat[i] != pat[j]) j = fail[j - 1];
    fail[i] = pat[i] == pat[j] ? ++j : 0;
  }
}
void search(int *arr) {
  for (int i = 0, j = 0; tex[i]; ++i) {
    while (j && tex[i] != pat[j]) j = fail[j - 1];
    arr[i] = tex[i] == pat[j] ? ++j : 0;
  }
  for (int i = 1; tex[i]; ++i) arr[i] = max(arr[i], arr[i - 1]);
}
bool check(int n) {
  int m = strlen(pat);
  if (m == 1) return 0;
  make_fail();
  search(pref);
  reverse(tex, tex + n);
  reverse(pat, pat + m);
  make_fail();
  search(suff);
  reverse(tex, tex + n);
  reverse(pat, pat + m);
  reverse(suff, suff + n);
  for (int i = 0; i < n - 1; ++i)
    if (pref[i] + suff[i + 1] >= m) return 1;
  return 0;
}
int main(void) {
  scanf("%s", tex);
  int n = strlen(tex), q = read(), ans = 0;
  for (int i = 1; i <= q; ++i) {
    scanf("%s", pat);
    if (check(n)) ++ans;
  }
  printf("%d\n", ans);
  return 0;
}
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
