#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)

using ull = unsigned long long;
const ull b = 1000000007;

ull f(string s) {
  ull h = 0;
  rep(i, s.size()) h = b * h + s[i];
  return h;
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  string s;
  cin >> s;
  int n = s.size();
  int q;
  cin >> q;
  vector<unordered_set<ull>> hashs(n + 1);
  rep(i, q) {
    string t;
    cin >> t;
    int m = t.size();
    if (m > n) continue;
    hashs[m].insert(f(t));
  }

  vector<int> l(n, -1);
  ull bb = 1;
  for (int len = 1; len <= n; len++) {
    bb *= b;
    if (hashs[len].empty()) continue;
    ull h = f(s.substr(0, len));
    int r = len - 1;
    while (true) {
      if (hashs[len].count(h) && l[r] == -1) {
        l[r] = r - len + 1;
      }
      r++;
      if (r >= n) break;
      h = b * h - bb * s[r - len] + s[r];
    }
  }

  int cnt = 0;
  int r = -1;
  rep(i, n) {
    if (r < l[i]) {
      cnt++;
      r = i;
    }
  }

  cout << cnt << endl;
}

