#! /usr/bin/env python3 def f(s, t): p = 0 cnt = 0 while 1: p = s.find(t) if p >= 0: cnt += 1 s = s[p+1:] else: break return cnt def main(): s = input() n = int(input()) print(sum(f(s, input()) for _ in range(n))) if __name__ == '__main__': main()