#include <bits/stdc++.h>
using namespace std;
char s[100005], w[1002];
int n, A, d[100005], f[1002], L, l;
int main() {
  scanf("%s %d", s, &n);
  for (; s[L]; L++)
    ;
  while (n--) {
    bool F = 0;
    scanf("%s", w);
    for (l = 0; w[l]; l++)
      ;
    if (l == 1) continue;
    for (int i = 0; i <= L - 1; i++) d[i] = -1;
    for (int i = 1, j = f[0] = -1; w[i]; i++) {
      while (j > -1 && w[i] != w[j + 1]) j = f[j];
      f[i] = j += w[i] == w[j + 1];
    }
    for (int i = 0, j = -1; s[i] && !F; i++) {
      while (j > -1 && s[i] != w[j + 1]) j = f[j];
      if (s[i] == w[j + 1]) j++;
      d[i + 1] = max(d[i], j);
      if (j == l - 1) F = 1;
    }
    for (int i = l - 2, j = f[l - 1] = l; i >= 0; i--) {
      while (j < l && w[i] != w[j - 1]) j = f[j];
      f[i] = j -= w[i] == w[j - 1];
    }
    for (int i = L - 1, j = l; i >= 0 && !F; i--) {
      while (j < l && s[i] != w[j - 1]) j = f[j];
      if (s[i] == w[j - 1]) {
        j--;
        if (j <= d[i] + 1) F = 1;
      }
    }
    A += F;
  }
  printf("%d\n", A);
}
