#include <bits/stdc++.h>
using namespace std;
char dr[100005], a[100005], d[100005], b[100005];
int n, m, pr[100005], p[100005], mx[100005];
bool solve() {
  scanf("%s", a + 1);
  m = strlen(a + 1);
  if (m == 1) return 0;
  for (int i = 2; i <= m; ++i) {
    int j = p[i - 1];
    while (j && a[i] != a[j + 1]) j = p[j];
    if (a[i] == a[j + 1])
      p[i] = j + 1;
    else
      p[i] = 0;
  }
  for (int i = 1, j = 0; i <= n; ++i) {
    while (j && dr[i] != a[j + 1]) j = p[j];
    if (dr[i] == a[j + 1])
      mx[i] = j + 1;
    else
      mx[i] = 0;
    j = mx[i];
  }
  for (int i = 1; i <= n; ++i) mx[i] = max(mx[i], mx[i - 1]);
  for (int i = 1; i <= m; ++i) b[i] = a[m - i + 1];
  for (int i = 2; i <= m; ++i) {
    int j = p[i - 1];
    while (j && b[i] != b[j + 1]) j = p[j];
    if (b[i] == b[j + 1])
      p[i] = j + 1;
    else
      p[i] = 0;
  }
  for (int i = 1, j = 0; i <= n; ++i) {
    while (j && d[i] != b[j + 1]) j = p[j];
    if (d[i] == b[j + 1])
      ++j;
    else
      j = 0;
    if (j + mx[n - i] >= m) return 1;
  }
  return 0;
}
int main() {
  scanf("%s", dr + 1);
  n = strlen(dr + 1);
  for (int i = 1; i <= n; ++i) d[i] = dr[n - i + 1];
  int m, ans = 0;
  scanf("%d", &m);
  for (int i = 1; i <= m; ++i) ans += solve();
  printf("%d", ans);
}
