#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int T, n, m, ans;
char s[N], p[N];
int ne[N], len[N];
int main() {
  scanf("%s", s + 1);
  m = strlen(s + 1);
  cin >> T;
  while (T--) {
    scanf("%s", p + 1);
    n = strlen(p + 1);
    if (n == 1) continue;
    for (int i = 2, j = 0; i <= n; i++) {
      while (j && p[i] != p[j + 1]) j = ne[j];
      if (p[i] == p[j + 1]) j++;
      ne[i] = j;
    }
    memset(len, 0, sizeof len);
    for (int i = 1, j = 0; i <= m; i++) {
      while (j && s[i] != p[j + 1]) j = ne[j];
      if (s[i] == p[j + 1]) j++;
      len[i] = max(len[i - 1], j);
      if (j == n) j = ne[j];
    }
    memset(ne, 0, sizeof ne);
    for (int i = 2, j = 0; i <= n; i++) {
      while (j && p[n - i + 1] != p[n - j]) j = ne[j];
      if (p[n - i + 1] == p[n - j]) j++;
      ne[i] = j;
    }
    bool flag = false;
    for (int i = 1, j = 0; i <= m; i++) {
      while (j && s[m - i + 1] != p[n - j]) j = ne[j];
      if (s[m - i + 1] == p[n - j]) j++;
      if (j && len[m - i] && (j + len[m - i] >= n)) {
        flag = true;
        break;
      }
      if (j == n) j = ne[j];
    }
    if (flag) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
