#include <bits/stdc++.h>
using namespace std;
const int N = 100100, M = 1010;
int n, m, e, ans, F[M], A[N], B[N];
char S[N], E[M];
void cook() {
  for (int i = 1; i <= e; ++i) {
    int j = i - 1;
    while (j && E[F[j] + 1] != E[i]) j = F[j];
    F[i] = F[j] + 1;
  }
}
int main() {
  F[0] = -1;
  scanf("%s%d", S + 1, &m);
  n = strlen(S + 1);
  for (int _ = 1; _ <= m; ++_) {
    scanf("%s", E + 1);
    e = strlen(E + 1);
    if (e == 1) continue;
    cook();
    for (int i = 1, j = 0; i <= n; ++i) {
      while (~j && S[i] != E[j + 1]) j = F[j];
      A[i] = ++j;
    }
    reverse(E + 1, E + 1 + e);
    cook();
    for (int i = n, j = 0; i >= 1; --i) {
      while (~j && S[i] != E[j + 1]) j = F[j];
      B[i] = ++j;
    }
    for (int i = 1; i <= n; ++i) A[i] = max(A[i], A[i - 1]);
    for (int i = n; i >= 1; --i) B[i] = max(B[i], B[i + 1]);
    for (int i = 1; i <= n - 1; ++i)
      if (A[i] + B[i + 1] >= e) {
        ++ans;
        break;
      }
  }
  printf("%d", ans);
  return 0;
}
