#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(iinclude<snt i=sta;i<=n;i++)
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

typedef pair<int, P> speP;

int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

ll mod_pow(ll x, ll n, ll m) {
	ll ret = 1;
	while (n) {
		if (n % 2)ret = ret * x%m;
		x = x * x%m; n >>= 1;
	}
	return ret;

}

struct rolling_hash {
private:
	int sz;
	vector<ll> node;
	vector<ll> r;
	ll t = 999999937;
	ll m = 1000000009;
	ll invt;
public:
	rolling_hash(const string &s) {
		int n = s.length();
		sz = n;
		node.resize(n + 1); r.resize(n + 1);
		node[0] = 0;

		invt = mod_pow(t, m - 2, m);
		ll a = 1;
		rep(i, n) {
			//r[i] = a;
			int z = s[i] - 'a';
			node[i + 1] = node[i] + a * z;
			node[i + 1] %= m;
			a = a * t%m;
		}
		a = 1;
		rep(i, n) {
			r[i] = a; a = invt * a%m;
		}
	}
	ll calc(int le, int len) {
		ll ret = node[le + len] - node[le];
		if (ret < 0)ret += m;
		ret = ret * r[le] % m;
		return ret;
	}
	ll on_hash(const string &s) {
		ll ret = 0;
		int len = s.length();
		ll a = 1;
		rep(i, len) {
			int z = s[i] - 'a';
			ret = (ret + a * z) % m;
			a = t * a%m;
		}
		return ret;
	}
};

vector<P> v;

//map<int, bool> mp[301];

int lemin[1 << 17];

bool comp(string &s, string &t) {
	return s.length() < t.length();
}

void solve() {
	string s; cin >> s;
	int m = s.length();
	rolling_hash r(s);

	fill(lemin, lemin + m, mod);


	int n; cin >> n;
	vector<string> st(n);
	rep(i, n) {
		cin >> st[i];
	}
	sort(st.begin(), st.end(), comp);
	rep(i, n) {
		if (st[i].size() < 300) {
			int le = i;
			while (i + 1 < n&&st[i].size() == st[i + 1].size())i++;
			map<int, bool> mp;
			for (int j = le; j <= i;j++) {
				ll ro = r.on_hash(st[j]);
				mp[ro] = true;
			}
			int len = st[i].size();
			rep(j, m - len + 1) {
				ll c = r.calc(j, len);
				if (mp[c]) {
					lemin[j] = min(lemin[j], j + len);
				}
			}
		}
		else {
			int len = st[i].length();
			ll ro = r.on_hash(st[i]);
			rep(j, m - len + 1) {
				ll le = r.calc(j, len);
				if (le == ro) {
					lemin[j] = min(lemin[j], j + len);
					//v.push_back({ j + len,j });
				}
			}
		}
	}

	rep(i, m) {
		if (lemin[i] < mod) {
			v.push_back({ lemin[i],i });
			//cout << i << " " << lemin[i] << endl;
		}
	}

	int le = -1;
	int ans = 0;



	sort(v.begin(), v.end());
	rep(i, v.size()) {
		if (le < v[i].second) {
			le=v[i].first-1; ans++;
		}
	}
	cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
		return 0;
}


Measured memory_bytes: 10032