#include <bits/stdc++.h>
using namespace std;
const int MAXN = 101 * 1000, MAXPAT = 1024;
string str, rstr, pat;
int m1[MAXN], m2[MAXN], b[MAXPAT];
bool ok() {
  if (((int)(pat).size()) < 2) return false;
  for (int i = 0, j = b[0] = -1; i < ((int)(pat).size()); b[++i] = ++j)
    while (j >= 0 && pat[j] != pat[i]) j = b[j];
  for (int i = 0, j = 0; i < ((int)(str).size());
       j++, m1[i] = i ? max(m1[i - 1], j) : j, i++)
    while (j >= 0 && str[i] != pat[j]) j = b[j];
  for (int i = 0, j = b[0] = -1; i < ((int)(pat).size()); b[++i] = ++j)
    while (j >= 0 &&
           pat[((int)(pat).size()) - 1 - j] != pat[((int)(pat).size()) - 1 - i])
      j = b[j];
  for (int i = ((int)(str).size()) - 1, j = 0; i >= 0;
       j++, m2[i] = (i + 1 < ((int)(str).size())) ? max(m2[i + 1], j) : j, i--)
    while (j >= 0 && str[i] != pat[((int)(pat).size()) - 1 - j]) j = b[j];
  for (register int i = (1); i < (int)(((int)(str).size())); ++i)
    if (m1[i - 1] + m2[i] >= ((int)(pat).size())) return true;
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> str;
  rstr = str;
  reverse((rstr).begin(), (rstr).end());
  int q, tot = 0;
  cin >> q;
  while (q--) {
    cin >> pat;
    if (ok()) tot++;
  }
  cout << tot << endl;
  return 0;
}
