S = raw_input() M = input() C = [raw_input() for _ in xrange(M)] d = {} for i, c in enumerate(S): if c in d: d[c].append(i) else: d[c] = [i] ans = 0 N = len(S) for s in C: L = d[s[0]] for i in L: for j, c in enumerate(s): if i+j >= N or S[i+j] != c: break else: ans += 1 print ans