#include <bits/stdc++.h>
using namespace std;
const int maxp = 110000;
char P[maxp];
int m, ans;
char T[maxp];
int fail[maxp];
int a[maxp], b[maxp];
void kmp_fail(char *t, int *fail) {
  int i, p = -1, l = strlen(t);
  for (fail[0] = -1, i = 1; i <= l; i++) {
    while (p >= 0 && t[i - 1] != t[p]) p = fail[p];
    p++;
    if (i < l && t[i] == t[p])
      fail[i] = fail[p];
    else
      fail[i] = p;
  }
}
void getnum(char *s, char *t, int *fail, int *a) {
  int n = strlen(s), ans = 0, l = strlen(t);
  for (int x = 0, i = 0; i < n; i++) {
    while (x >= 0 && s[i] != t[x]) x = fail[x];
    ++x;
    a[i] = x;
    if (x == l) {
      ans++;
      x = fail[x];
    }
  }
}
int cheak() {
  if (strlen(T) < 2) return 0;
  reverse(P, P + strlen(P));
  reverse(T, T + strlen(T));
  kmp_fail(T, fail);
  getnum(P, T, fail, b);
  reverse(P, P + strlen(P));
  reverse(T, T + strlen(T));
  kmp_fail(T, fail);
  getnum(P, T, fail, a);
  int L = strlen(P), LT = strlen(T);
  for (int i = 1; i < L; i++)
    a[i] = max(a[i], a[i - 1]), b[i] = max(b[i], b[i - 1]);
  for (int i = 1; i < L; i++)
    if (a[i - 1] + b[L - i - 1] >= LT) return 1;
  return 0;
}
int main() {
  scanf("%s", P);
  scanf("%d", &m);
  while (m--) {
    scanf("%s", T);
    if (cheak()) ans++;
  }
  cout << ans << endl;
}
