Teddy and Freddy are two friends. Teddy has a pile of strings of size $N$. Each string $Si$ in the pile has length less or equal to $100$ ($len(Si) \leq 100$). 
Teddy and Freddy like playing with strings. Teddy gives Freddy a string $B$ of size $M$.
Teddy and Freddy like playing with strings. Teddy gives Freddy a string $B$ of size $M$.
He asks Freddy to find the count of the unique substrings of $B$ present in pile of strings of size $N$.
Freddy is busy with the some task, so he asks for your help.Help Freddy by giving the unique substrings of $B$ present in pile of strings of size $N$.
Note: The substrings having same permutation of characters are considered same.

-----Input:-----
- First line will contain $N$, number of strings. Then the strings follow. 
- Next $N$ lines will contain a string 
- $N+2$ line contains the $M$ - length of string B
- Following line contains the string B

-----Output:-----
For each testcase, output in a single line number of unique strings of B.

-----Constraints-----
- $1 \leq N \leq 100$
- $2 \leq len(Si) \leq 100$
- $2 \leq M \leq 100$

-----Sample Input:-----
4
a
abc 
abcd
abcde
5
aaaaa

-----Sample Output:-----
1

-----Sample Input:-----
4
a
aa
aaa
aaaa
5
aaaaa

-----Sample Output:-----
4

-----EXPLANATION:-----
TestCase 1: Only substring of $aaaaa$ that is present in the pile of strings is $a$. So the answer is 1

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
n = int(input())
l = []
for i in range(n):
	l.append(input())
m = int(input())
s = input()
c = 0
res = [s[i:j] for i in range(len(s)) for j in range(i + 1, len(s) + 1)]
res = list(dict.fromkeys(res))
for i in res:
	if i in l:
		c = c + 1
print(c)


has = [input() for _ in range(int(input()))]
lens = int(input())
B = input()
cnt = 0
alls = set()
for i in range(lens):
	for j in range(i, lens):
		curr = B[i:j + 1]
		if curr in alls:
			continue
		cnt += curr in has
		alls.add(curr)
print(cnt)


t = int(input())
d = []
count = 0
for i in range(0, t):
	f = input()
	d.append(f)
d = list(set(d))
y = int(input())
r = input()
for l in range(0, len(d)):
	if d[l] in r:
		count += 1
print(count)


n = int(input())
l = []
for u in range(n):
	s = input()
	l.append(s)
m = int(input())
x = input()
ans = 0
t = []
for i in range(m):
	for j in range(i, m):
		t.append(x[i:j + 1])
t = list(set(t))
for i in t:
	if i in l:
		ans += 1
print(ans)


n = int(input())
l = []
for i in range(n):
	l.append(input())
m = int(input())
b = input()
d = set()
for i in range(n):
	if l[i] in b:
		d.add(l[i])
print(len(list(d)))


n = int(input())
x = []
y = []
d = []
c = 0
for i in range(n):
	m = input()
	x.append(m)
k = int(input())
g = input()
l = len(g)
for j in range(l):
	for t in range(l):
		p = g[j:n - (n - t) + 1]
		if p != '':
			y.append(p)
for r in y:
	if r not in d:
		d.append(r)
for s in d:
	if s in x:
		c = c + 1
print(c)


def subString(s, n):
	lst = []
	for i in range(n):
		for len in range(i + 1, n + 1):
			lst.append(s[i:len])
	return lst
lst = []
for _ in range(int(input())):
	n = input()
	lst.append(n)
m = int(input())
b = input()
subs = subString(b, m)
uniques = []
count = 0
for i in subs:
	if i not in uniques:
		uniques.append(i)
for i in uniques:
	if i in lst:
		count += 1
print(count)


lst = []
for _ in range(int(input())):
	lst.append(input())
m = int(input())
k = input()
lst1 = []
for i in range(len(k)):
	for j in range(i + 1, len(k) + 1):
		lst1.append(k[i:j])
count = 0
lst1 = set(lst1)
for i in lst1:
	for j in lst:
		if i == j:
			count += 1
			break
print(count)


n = int(input())
pile = []
for i in range(n):
	pile.append(input())
m = int(input())
st = input()
ans = 0
for i in set(pile):
	if i in st:
		ans += 1
print(ans)


n = int(input())
l = []
for i in range(n):
	s = input()
	if s not in l:
		l.append(s)
m = int(input())
s = input()
c = 0
for i in l:
	if i in s:
		c += 1
print(c)