s=input() m=len(s)-1 n=int(input()) c=0 for _ in [0]*n: t=input() if t not in s: continue r=s for _ in [0]*m: if t not in r: break c+=1 r=r[r.find(t)+1:] print(c)