#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

using ll = long long;

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

    string s;
    cin >> s;
    int m;
    cin >> m;

    ll ans = 0;
    for (int i = 0; i < m; i++) {
        string c;
        cin >> c;
        int pos = 0;
        auto res = s.find(c, pos);
        while (res != -1) {
            ans++;
            res = s.find(c, res + 1);
        }
    }
    cout << ans << endl;

    return 0;
}