#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 9;
string s, t;
int n, pre[MAX], suf[MAX], f[MAX], m, q, ans;
void kmp(int *d) {
  f[0] = 0;
  for (int i = 1, k = 0; i < m; i++) {
    while (k > 0 && t[k] != t[i]) k = f[k - 1];
    if (t[i] == t[k]) k++;
    f[i] = k;
  }
  for (int i = 0, k = 0; i < n; i++) {
    while (k > 0 && t[k] != s[i]) k = f[k - 1];
    if (s[i] == t[k]) k++;
    d[i] = k;
    if (k == m) k = f[k - 1];
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> s >> q, n = s.size();
  while (q--) {
    cin >> t, m = t.size();
    if (m == 1) continue;
    kmp(pre), reverse(s.begin(), s.end()), reverse(t.begin(), t.end()),
        kmp(suf), reverse(s.begin(), s.end());
    for (int i = 1; i < n; i++)
      pre[i] = max(pre[i], pre[i - 1]), suf[i] = max(suf[i - 1], suf[i]);
    for (int i = 0; i < n - 1; i++)
      if (pre[i] + suf[n - i - 2] >= m) {
        ans++;
        break;
      }
  }
  cout << ans;
}
