#include using namespace std; #define all(v) (v).begin(),(v).end() #define pb(a) push_back(a) #define rep(i, n) for(int i=0;i> s; int n; cin >> n; map st; rep(i, n) { string t; cin >> t; st[t] ++; } n = s.size(); int ans = 0; rep(i, n) { string t = ""; rep(j, 10) { if(i + j >= n) break; t += s[i + j]; ans += st[t]; } } cout << ans << endl; return 0; }