#include <bits/stdc++.h>
using namespace std;
int fl[100042];
int posL[100042], posR[1000042];
void kmp(string &p, string &t, int pos[]) {
  for (int i = 0; i <= p.size(); i++) {
    fl[i] = 0;
  }
  fl[0] = -1;
  fl[1] = 0;
  for (int i = 1; i < p.size(); i++) {
    for (int j = fl[i]; j != -1; j = fl[j]) {
      if (p[i] == p[j]) {
        fl[i + 1] = j + 1;
        break;
      }
    }
  }
  for (int i = 0, j = 0; i < t.size();) {
    if (t[i] == p[j]) {
      j++;
      pos[i] = j;
      i++;
    } else {
      j = fl[j];
      if (j == -1) {
        j = 0;
        i++;
      }
    }
  }
}
string tt, crr;
int main() {
  cin >> tt;
  int n, ans = 0, m;
  cin >> n;
  m = n;
  while (n--) {
    cin >> crr;
    if (crr.size() == 1) {
      continue;
    }
    kmp(crr, tt, posL);
    for (int i = 0; i < tt.size(); i++) {
      posL[i] = max(posL[i], posL[i - 1]);
    }
    reverse(crr.begin(), crr.end());
    reverse(tt.begin(), tt.end());
    kmp(crr, tt, posR);
    reverse(posR, posR + tt.size());
    for (int i = 0; i < tt.size() - 1; i++) {
      if (posL[i] + posR[i + 1] >= crr.size()) {
        ans++;
        break;
      }
    }
    for (int i = 0; i <= tt.size(); i++) {
      posL[i] = 0;
      posR[i] = 0;
    }
    reverse(tt.begin(), tt.end());
  }
  cout << ans << "\n";
  return 0;
}
