#include <bits/stdc++.h>
using namespace std;
int n, m, len, kmpA[100010], ans, kmpB[100010], mxA[100010], mxB[100010];
char S[100010], A[100010], B[100010];
int main() {
  scanf("%s", S + 1);
  n = strlen(S + 1);
  scanf("%d", &m);
  while (m--) {
    scanf("%s", A);
    kmpA[0] = -1;
    len = strlen(A);
    if (len == 1) continue;
    for (int i = 1, k = -1; i <= len; i++) {
      while (k != -1 && A[i - 1] != A[k]) k = kmpA[k];
      k++;
      kmpA[i] = k;
    }
    for (int i = 0; i <= len - 1; i++) B[len - 1 - i] = A[i];
    kmpB[0] = -1;
    for (int i = 1, k = -1; i <= len; i++) {
      while (k != -1 && B[i - 1] != B[k]) k = kmpB[k];
      k++;
      kmpB[i] = k;
    }
    for (int i = 1, k = 0; i <= n; i++) {
      while (k != -1 && S[i] != A[k]) k = kmpA[k];
      k++;
      mxA[i] = k;
    }
    for (int i = n, k = 0; i >= 1; i--) {
      while (k != -1 && S[i] != B[k]) k = kmpB[k];
      k++;
      mxB[i] = k;
    }
    for (int i = 1; i <= n; i++) mxA[i] = max(mxA[i - 1], mxA[i]);
    for (int i = n; i >= 1; i--) mxB[i] = max(mxB[i + 1], mxB[i]);
    bool flag = false;
    for (int i = 1; i <= n + 1; i++) {
      if (mxA[i - 1] + mxB[i] >= len) {
        flag = true;
        break;
      }
    }
    ans += flag;
  }
  cout << ans;
  return 0;
}
