#include <bits/stdc++.h>
using namespace std;
const int MX = 101005;
char s[MX], t[MX];
int q, z[MX], pos1[1003], pos2[1003];
void compute(int len, char s[], int z[]) {
  memset(z, 0, len * sizeof(z[0]));
  int l = 0, r = 0;
  for (int i = 1; i < len; i++) {
    if (i <= r) z[i] = min(z[i - l], r - i + 1);
    for (int j = i + z[i], p = z[i]; j < len; j++, p++) {
      if (s[p] == s[j])
        z[i]++;
      else
        break;
    }
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
}
void calc(char s[], int n, int len, int pos[]) {
  compute(n + len + 1, s, z);
  memset(pos, -1, 1001 * sizeof(pos[0]));
  for (int i = n + 1; i < n + len + 1; i++) {
    if (pos[z[i]] == -1) pos[z[i]] = i;
  }
  for (int i = n - 1; i > 0; i--) {
    if (pos[i + 1] > 0) {
      if (pos[i] < 0) pos[i] = pos[i + 1];
      pos[i] = min(pos[i], pos[i + 1]);
    }
  }
}
int main() {
  scanf("%s %d", s, &q);
  int len = strlen(s), ans = 0;
  while (q--) {
    scanf("%s", t);
    int n = strlen(t);
    strcat(t, "#");
    strcat(t, s);
    calc(t, n, len, pos1);
    reverse(t, t + n);
    reverse(t + n + 1, t + n + len + 1);
    calc(t, n, len, pos2);
    for (int k = 1; k < n; k++) {
      int l = pos1[k] - n - 1;
      if (l < 0) continue;
      int r = pos2[n - k] - n - 1;
      if (r < 0) continue;
      r += n - k - 1;
      r = len - 1 - r;
      if (r >= l + k) {
        ans++;
        break;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
