source = input() n = int(input()) match_list = [] for _ in range(n): match_list.append(input()) n_source = len(source) answer = 0 for match in match_list: n_match = len(match) for i in range(n_source - n_match + 1): if match in source[i:i+n_match]: answer += 1 print(answer)