#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
const int inf = INT_MAX >> 1;
char t[maxn], rt[maxn];
char s[maxn], rs[maxn];
int nxt[maxn];
int pos[maxn];
int n;
int ans;
void get_nxt() {
  int len = strlen(s);
  nxt[0] = -1;
  int i = 0, j = -1;
  while (i < len - 1) {
    if (j == -1 || s[i] == s[j]) {
      j++;
      i++;
      nxt[i] = j;
    } else {
      j = nxt[j];
    }
  }
}
void kmp(int flag) {
  int tlen = strlen(t), slen = strlen(s);
  int i = 0, j = 0;
  while (i < tlen && j < slen) {
    if (j == -1 || t[i] == s[j]) {
      if (j != -1 && flag == 1 && pos[j] == -1) pos[j] = i;
      if (flag == 0 && j != -1) {
        if (slen - j - 2 >= 0 && pos[slen - j - 2] != -1) {
          if (pos[slen - j - 2] < tlen - i - 1) {
            ans++;
            break;
          }
        }
      }
      i++, j++;
    } else {
      j = nxt[j];
    }
  }
}
int main() {
  scanf("%s", t);
  strcpy(rt, t);
  scanf("%d", &n);
  ans = 0;
  while (n--) {
    memset(pos, -1, sizeof(pos));
    scanf("%s", s);
    get_nxt();
    kmp(1);
    reverse(s, s + strlen(s));
    reverse(t, t + strlen(t));
    get_nxt();
    kmp(0);
    reverse(t, t + strlen(t));
  }
  printf("%d\n", ans);
  return 0;
}
