#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, w, e, r, t, y = 0, i, d[100001], f[1000];
  char a[100001], s[1001], c;
  scanf("%s", a);
  q = strlen(a);
  for (scanf("%d", &i); i; i--) {
    scanf("%s", s);
    w = strlen(s);
    if (w == 1) continue;
    e = f[0] = 0;
    for (r = 1; r < w; r++) {
      while ((e) && (s[e] != s[r])) e = f[e - 1];
      if (s[e] == s[r]) e++;
      f[r] = e;
    }
    t = e = 0;
    for (r = 0; r < q; r++) {
      while ((e) && (s[e] != a[r])) e = f[e - 1];
      if (s[e] == a[r]) e++;
      t = max(t, e);
      d[r] = t;
      if (e == w) {
        y++;
        goto st;
      }
    }
    for (e = 0, r = w - 1; e < r; e++, r--) {
      c = s[e];
      s[e] = s[r];
      s[r] = c;
    }
    e = f[0] = 0;
    for (r = 1; r < w; r++) {
      while ((e) && (s[e] != s[r])) e = f[e - 1];
      if (s[e] == s[r]) e++;
      f[r] = e;
    }
    t = e = 0;
    for (r = q - 1; r; r--) {
      while ((e) && (s[e] != a[r])) e = f[e - 1];
      if (s[e] == a[r]) e++;
      t = max(t, e);
      if (d[r - 1] + t >= w) {
        y++;
        goto st;
      }
    }
  st:;
  }
  printf("%d", y);
  return 0;
}
