#include <bits/stdc++.h>
using namespace std;
char s[100005], t[1005], con[101005];
int q, z[101005], x[101005];
int ls, lt;
void doit() {
  int l = 0, r = 0;
  for (int i = 1; i < ls + lt; i++) {
    if (i > r) {
      l = r = i;
      while (r < ls + lt && con[r - l] == con[r]) r++;
      z[i] = r - l;
      r--;
    } else {
      if (z[i - l] < r - i + 1)
        z[i] = z[i - l];
      else {
        l = i;
        while (r < ls + lt && con[r - l] == con[r]) r++;
        z[i] = r - l;
        r--;
      }
    }
  }
}
int main() {
  scanf("%s", s);
  ls = strlen(s);
  scanf("%d", &q);
  int ret = 0;
  for (int i = 0; i < q; i++) {
    scanf("%s", t);
    lt = strlen(t);
    if (lt == 1) continue;
    for (int j = 0; j < ls + lt; j++)
      if (j < lt)
        con[j] = t[j];
      else
        con[j] = s[j - lt];
    doit();
    memcpy(x, z, sizeof(z));
    for (int j = 0; j < ls + lt; j++)
      if (j < lt)
        con[j] = t[lt - j - 1];
      else
        con[j] = s[ls + lt - j - 1];
    doit();
    for (int j = lt + ls - 1; j >= lt; j--) {
      int ti = x[j];
      x[j] = 0;
      x[j + ti - 1] = max(x[j + ti - 1], ti);
      ti = z[j];
      z[j] = 0;
      z[j + ti - 1] = max(z[j + ti - 1], ti);
    }
    for (int j = lt + 1; j < lt + ls; j++) {
      x[j] = max(x[j], x[j - 1]);
      z[j] = max(z[j], z[j - 1]);
    }
    int ok = 0;
    for (int j = lt; j < lt + ls; j++) {
      if (j == lt + ls - 1) {
        if (x[j] >= lt) ok = 1;
        break;
      }
      if (x[j] + z[lt + ls - 2 + lt - j] >= lt) {
        ok = 1;
        break;
      }
    }
    ret += ok;
  }
  printf("%d\n", ret);
}
