#include <bits/stdc++.h>
using namespace std;
const int MAXn = 2e5 + 10;
char Num[MAXn], Temp[1100], RNum[MAXn], RTemp[1100];
int Lost[1100], Max[MAXn], Ans, Len, Lenx, Total;
inline void File() {
  freopen(".in", "r", stdin);
  freopen(".out", "w", stdout);
}
inline void Get_Lost() {
  int Loc = 0;
  Lost[0] = Lost[1] = 0;
  for (long long i = 1; i <= Lenx - 1; i++) {
    while (Loc && Temp[i] != Temp[Loc]) Loc = Lost[Loc];
    Lost[i + 1] = (Temp[i] == Temp[Loc]) ? ++Loc : 0;
  }
}
inline void Match() {
  int Loc = 0;
  for (long long i = 0; i <= Len - 1; i++) {
    while (Loc && Num[i] != Temp[Loc]) Loc = Lost[Loc];
    Loc += (Temp[Loc] == Num[i]) ? 1 : 0;
    Max[i] = max(Max[i], max(Loc, Max[i - 1]));
  }
}
inline void Solve() {
  int Loc = 0;
  for (long long i = 0; i <= Len - 1; i++) {
    while (Loc && Num[i] != Temp[Loc]) Loc = Lost[Loc];
    Loc += (Num[i] == Temp[Loc]) ? 1 : 0;
    if (Loc + Max[Len - i - 2] >= Lenx && Loc != 0 && Max[Len - i - 2] != 0) {
      Ans++;
      break;
    }
  }
}
int main() {
  scanf("%s", Num);
  Len = strlen(Num);
  scanf("%d", &Total);
  while (Total--) {
    scanf("%s", Temp);
    memset((Max), (0), sizeof(Max));
    memset((Lost), (0), sizeof(Lost));
    Lenx = strlen(Temp);
    if (Lenx == 1) continue;
    Get_Lost();
    Match();
    reverse(Temp, Temp + Lenx);
    reverse(Num, Num + Len);
    memset((Lost), (0), sizeof(Lost));
    Get_Lost();
    Solve();
    reverse(Num, Num + Len);
  }
  printf("%d\n", Ans);
  return 0;
}
