def counter(s: str, t: str) -> int: m = 0 while True: if len(s) < len(t) or t not in s: break if t in s: m += 1 s = s[s.index(t)+1:] return m s = input() print(sum( counter(s, t) if t in s else 0 for t in [input() for _ in range(int(input()))] ) )