#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
template <typename T>
void read(T &x) {
  x = 0;
  long long f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  x *= f;
}
long long nxt[N];
void KMP(char s[], char t[], long long maxx[]) {
  long long n = strlen(s + 1), m = strlen(t + 1);
  for (long long i = 2; i <= m; i++) {
    long long j = nxt[i - 1];
    while (j && t[j + 1] != t[i]) j = nxt[j];
    if (t[j + 1] == t[i])
      nxt[i] = j + 1;
    else
      nxt[i] = j;
  }
  long long j = 0;
  for (long long i = 1; i <= n; i++) {
    while (j && t[j + 1] != s[i]) j = nxt[j];
    if (t[j + 1] == s[i]) j++;
    maxx[i] = max(maxx[i - 1], j);
    if (j == m) j = nxt[j];
  }
}
long long n, m;
char s1[N], s2[N], t1[N], t2[N];
long long max1[N], max2[N];
signed main() {
  scanf("%s", s1 + 1);
  n = strlen(s1 + 1);
  for (long long i = 1; i <= n; i++) s2[i] = s1[n - i + 1];
  read(m);
  long long ans = 0;
  for (long long gjm = 1; gjm <= m; gjm++) {
    scanf("%s", t1 + 1);
    long long m = strlen(t1 + 1);
    if (m == 1) continue;
    for (long long i = 1; i <= m; i++) t2[i] = t1[m - i + 1];
    KMP(s1, t1, max1);
    KMP(s2, t2, max2);
    for (long long i = 1; i <= n; i++)
      if (max1[i] + max2[n - i] >= m) {
        ans++;
        break;
      }
  }
  printf("%d\n", ans);
  return 0;
}
