#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <functional>
using namespace std;

template<typename Type> class RangeMin {
private:
	int size_;
	std::vector<Type> dat;
public:
	RangeMin() : size_(0), dat(std::vector<Type>()) {};
	RangeMin(int size__) {
		for (size_ = 1; size_ < size__; ) size_ <<= 1;
		dat.resize(size_ << 1, std::numeric_limits<Type>::max());
	}
	template<class T>
	RangeMin(T begin_, T end_) {
		int n = end_ - begin_;
		for (size_ = 1; size_ < n; size_ <<= 1); dat.resize(size_ << 1, std::numeric_limits<Type>::max());
		for (int i = 0; i < n; i++) dat[i + size_] = *(begin_ + i);
		for (int i = size_ - 1; i > 0; i--) dat[i] = std::min(dat[i << 1], dat[(i << 1) + 1]);
	}
	inline unsigned size() { return size_; }
	inline void update(int i, Type x) {
		i += size_; dat[i] = x;
		while (i > 1) {
			i >>= 1;
			dat[i] = std::min(dat[i << 1], dat[i << 1 | 1]);
		}
	}
	inline Type query(int l, int r) {
		Type ret = std::numeric_limits<Type>::max();
		l += size_; r += size_;
		while (l != r) {
			if (l & 1) ret = std::min(ret, dat[l++]); l >>= 1;
			if (r & 1) ret = std::min(ret, dat[--r]); r >>= 1;
		}
		return ret;
	}
};

long long power[100009]; const long long HASH = 311;

class RollingHash {
public:
	string A; vector<long long>dat;

	void init(string T) {
		A = T;
		dat.resize(A.size() + 1, 0);
		dat[0] = 0;
		for (int i = 0; i < A.size(); i++) {
			dat[i + 1] = dat[i] * HASH + A[i];
		}
	}
	long long roll(long long l, long long r) {
		// 半開区間
		return (dat[r] - power[r - l] * dat[l]);
	}
};

void init_math() {
	power[0] = 1;
	for (int i = 1; i <= 100008; i++) power[i] = HASH * power[i - 1];
}
long long hash_value(string S) {
	long long F = 0;
	for (int i = 0; i < S.size(); i++) F = F * HASH + S[i];
	return F;
}

string S, T[100009]; int n;
vector<pair<int, string>>X; vector<int>J; vector<pair<int, int>>Z;
vector<pair<long long, int>>vec;

int main() {
	cin >> S >> n; init_math();
	for (int i = 1; i <= n; i++) { cin >> T[i]; X.push_back(make_pair(T[i].size(), T[i])); }
	sort(X.begin(), X.end());
	for (int i = 1; i <= n; i++) T[i] = X[i - 1].second;

	RollingHash A; A.init(S);
	RangeMin<int> Y(S.size() + 2);

	for (int i = 1; i <= n; i++) {
		if (T[i].size() >= 100) {
			long long V1 = hash_value(T[i]);

			for (int j = 0; j < S.size() - T[i].size() + 1; j++) {
				if (Y.query(j, j + T[i].size()) <= j + T[i].size()) continue;
				if (A.roll(j, j + T[i].size()) == V1) {
					Z.push_back(make_pair(j, j + T[i].size() - 1));
					
					Y.update(j, min(Y.query(j, j + 1), (int)j + (int)T[i].size()));
				}
			}
		}

		else {
			if (i == 0 || T[i].size() != T[i - 1].size()) {
				vec.clear();
				for (int j = 0; j < S.size() - T[i].size() + 1; j++) {
					if (Y.query(j, j + T[i].size()) <= j + T[i].size()) continue;
					
					vec.push_back(make_pair(A.roll(j, j + T[i].size()), j));
				}
				sort(vec.begin(), vec.end());
			}
			long long V1 = hash_value(T[i]);
			int pos1 = lower_bound(vec.begin(), vec.end(), make_pair(V1, 0)) - vec.begin();

			for (int j = pos1; j < vec.size(); j++) {
				if (vec[j].first != V1) break;
				Z.push_back(make_pair(vec[j].second, vec[j].second + T[i].size() - 1));
				
				Y.update(vec[j].second, min(Y.query(vec[j].second, vec[j].second + 1), (int)vec[j].second + (int)T[i].size()));
			}
		}
	}
	sort(Z.begin(), Z.end());
	
	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>Q;
	for (int i = 0; i < Z.size(); i++) Q.push(make_pair(Z[i].second, Z[i].first));

	int cx = 0, cnt = 0;

	while (!Q.empty()) {
		cnt++;
		cx = Q.top().first;
		while (!Q.empty() && Q.top().second <= cx) Q.pop();
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 11708