#include using namespace std; typedef vector< int > vi; const int BS = 311; const int MOD7 = 1e9 + 7; signed main(){ string S; cin >> S; vi ph( S.size() + 1 ); vi bspw( S.size() + 1 ); bspw[ 0 ] = 1; for( int i = 0; i < S.size(); ++i ) ph[ i + 1 ] = ( 1LL * ph[ i ] * BS + S[ i ] ) % MOD7, bspw[ i + 1 ] = 1LL * bspw[ i ] * BS % MOD7; int M; cin >> M; int ans = 0; for( int i = 0; i < M; ++i ){ string C; cin >> C; int hv = 0; for( int j = 0; j < C.size(); ++j ) hv = ( 1LL * hv * BS + C[ j ] ) % MOD7; for( int j = C.size(); j <= S.size(); ++j ) ans += hv == ( ( 1LL * ph[ j ] - 1LL * bspw[ C.size() ] * ph[ j - C.size() ] ) % MOD7 + MOD7 ) % MOD7; } cout << ans << endl; return 0; }