#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1024;
char s[MAXN * 128], p[MAXN];
int nex[MAXN], pos[MAXN], n, ans;
void init() {
  memset(nex, 0, sizeof(nex));
  memset(pos, 0, sizeof(pos));
}
void get_nex() {
  int len = strlen(p + 1);
  int j = 0;
  for (int i = 2; i <= len; i++) {
    while (j && p[j + 1] != p[i]) j = nex[j];
    if (p[j + 1] == p[i]) j++;
    nex[i] = j;
  }
}
void work(bool flg) {
  int j = 0;
  int lenp = strlen(p + 1), lens = strlen(s + 1);
  for (int i = 1; i <= lens; i++) {
    while (j && p[j + 1] != s[i]) j = nex[j];
    if (p[j + 1] == s[i]) {
      j++;
      if (!flg) {
        if (!pos[j]) pos[j] = i;
      } else {
        if (pos[lenp - j] && pos[lenp - j] < lens - i + 1) {
          ans++;
          break;
        }
      }
    }
    if (j == lenp && !flg) break;
  }
}
void rev() {
  int lenp = strlen(p + 1), lens = strlen(s + 1);
  for (int i = 1; i <= lenp / 2; i++) swap(p[i], p[lenp - i + 1]);
  for (int i = 1; i <= lens / 2; i++) swap(s[i], s[lens - i + 1]);
}
int main() {
  scanf("%s%d", s + 1, &n);
  while (n--) {
    init();
    scanf("%s", p + 1);
    get_nex();
    work(0);
    rev();
    get_nex();
    work(1);
    rev();
  }
  printf("%d\n", ans);
  return 0;
}
