#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
vector<int> suffix(const string &T) {
  int n = T.size();
  vector<int> f(n + 1);
  for (int len = 2; len <= n; ++len) {
    int x = len - 1;
    while (x > 0) {
      x = f[x];
      if (T[x] == T[len - 1]) {
        f[len] = x + 1;
        break;
      }
    }
  }
  return f;
}
vector<int> cal(const string &T, const vector<int> &f, const string &S) {
  int n = S.size();
  vector<int> g(n + 1);
  int i = 0;
  int j = 0;
  while (i < S.size() && j < T.size()) {
    if (S[i] == T[j]) {
      ++i;
      ++j;
      g[i] = j;
    } else {
      if (j == 0)
        ++i;
      else
        j = f[j];
    }
  }
  for (int i = 1; i <= n; ++i) g[i] = g[i - 1] < g[i] ? g[i] : g[i - 1];
  return g;
}
int main() {
  string S;
  cin >> S;
  int m;
  cin >> m;
  int ret = 0;
  for (int i = 0; i < m; ++i) {
    string T;
    cin >> T;
    if (T.size() > 1) {
      auto fT = suffix(T);
      auto gT = cal(T, fT, S);
      reverse(T.begin(), T.end());
      reverse(S.begin(), S.end());
      auto Tf = suffix(T);
      auto Tg = cal(T, Tf, S);
      reverse(S.begin(), S.end());
      bool good = false;
      for (int len = 1; len < S.size(); ++len)
        if (gT[len] >= 1 && Tg[S.size() - len] >= 1 &&
            gT[len] + Tg[S.size() - len] >= T.size())
          good = true;
      ret += good;
    }
  }
  cout << ret << endl;
  return 0;
}
