#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
char T[N], P[N];
int f[N];
int d[3][N];
void exkmp(char P[], char T[], int t) {
  int i, j, k;
  int m = strlen(P), n = strlen(T);
  f[0] = f[1] = 0;
  j = 0;
  for (int i = 1; i < m; i++) {
    int j = f[i];
    while (j && P[i] != P[j]) j = f[j];
    f[i + 1] = P[i] == P[j] ? j + 1 : 0;
  }
  j = 0;
  for (int i = 0; i < n; i++) {
    while (j && T[i] != P[j]) j = f[j];
    if (P[j] == T[i]) j++;
    d[t][i] = j;
  }
}
long long cnt[N];
char TR[N];
char PR[N];
int main() {
  scanf("%s", T);
  long long ans = 0;
  int n = strlen(T);
  ;
  ;
  strcpy(TR, T);
  reverse(TR, TR + n);
  int re;
  cin >> re;
  while (re--) {
    scanf("%s", P);
    exkmp(P, T, 1);
    int m = strlen(P);
    strcpy(PR, P);
    if (m == 1) continue;
    reverse(PR, PR + m);
    exkmp(PR, TR, 2);
    for (int i = 1; i < n; i++) d[1][i] = max(d[1][i], d[1][i - 1]);
    for (int i = 1; i < n; i++) d[2][i] = max(d[2][i], d[2][i - 1]);
    int yes = 0;
    for (int i = 0; i < n; i++) {
      int j = n - i - 2;
      if (j < 0) continue;
      int x = d[1][i], y = d[2][j];
      if (x + y >= m) {
        yes = 1;
        break;
      }
    }
    ans += yes;
  }
  cout << ans << endl;
}
