s = input() m = int(input()) a = 0 for i in range(m): f = input() g = 0 while True: t = s.find(f,g) if t == -1: break else: a += 1 g = t + 1 print(a)