#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 400010;
int len1, len2;
char s[100100], s1[100100], t[1005], t1[1005];
void kmp_pre(char x[], int m, int nxt[]) {
  int i, j;
  i = 0;
  j = nxt[0] = -1;
  while (i < m) {
    while (j != -1 && x[i] != x[j]) j = nxt[j];
    nxt[++i] = ++j;
  }
}
int nxt[1005], temp;
void kmp(char x[], int m, char y[], int n, int a[]) {
  int i, j;
  kmp_pre(x, m, nxt);
  i = j = 0;
  while (i < n) {
    while (j != -1 && y[i] != x[j]) j = nxt[j];
    a[i] = j;
    i++;
    j++;
    if (j >= m) {
      temp++;
      j = nxt[j];
    }
  }
}
int a[100100], b[100100], cnt[100100];
int main() {
  scanf("%s", s);
  len1 = strlen(s);
  for (int i = 0; i < len1; i++) s1[i] = s[len1 - 1 - i];
  int n;
  scanf("%d", &n);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%s", t);
    len2 = strlen(t);
    if (len2 == 1) continue;
    for (int i = 0; i < len2; i++) t1[i] = t[len2 - 1 - i];
    kmp(t, len2, s, len1, a);
    kmp(t1, len2, s1, len1, b);
    memset(cnt, -1, sizeof(cnt));
    for (int j = 0; j < len1; j++) {
      cnt[len1 - 1 - j] = max(cnt[len1 - 1 - j + 1], b[j]);
    }
    bool ok = false;
    for (int j = 0; j < len1; j++) {
      if (a[j] == -1) continue;
      int temp = a[j];
      int tar = j + 1;
      int rtemp = cnt[tar];
      if (temp + rtemp + 2 >= len2) {
        ok = true;
        break;
      }
    }
    if (ok) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
