import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class ACAutomation {
private static InputReader in = new InputReader();
private static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws IOException {
int n = in.nextInt();
AC ac = new AC();
for (int i = 0; i < n; i++) {
ac.insert(in.next());
}
List<String> list = ac.containWords(in.next());
out.println(list.size());
in.bf.close();
out.close();
}
private static class MyQueue {
private int last;
private int first;
private Node[] arr;
public MyQueue(int size) {
arr = new Node[size];
last = 0;
first = 0;
}
public void add(Node node) {
if (node != null && last < arr.length) {
arr[last++] = node;
}
}
public Node poll() {
if (!isEmpty()) {
return arr[first++];
}
return null;
}
public boolean isEmpty() {
return first == last;
}
}
private static class Node {
public String end;
public int ends;
public boolean endUse;
public Node fail;
public Node[] nexts;
public Node() {
endUse = false;
end = null;
ends = 0;
fail = null;
nexts = new Node[26];
}
}
public static class AC {
private Node root;
public AC() {
root = new Node();
}
public void insert(String str) {
char[] strs = str.toCharArray();
int index = -1;
Node cur = root;
for (int i = 0; i < strs.length; i++) {
index = strs[i] - 'a';
if (cur.nexts[index] == null) {
cur.nexts[index] = new Node();
}
cur = cur.nexts[index];
}
cur.end = str;
cur.ends++;
}
public void buildFail() {
MyQueue queue = new MyQueue(1000000);
Node cur = root;
Node curFail = null;
queue.add(root);
while (!queue.isEmpty()) {
cur = queue.poll();
for (int i = 0; i < root.nexts.length; i++) {
if (cur.nexts[i] != null) {
cur.nexts[i].fail = root;
curFail = cur.fail;
while (curFail != null) {
if (curFail.nexts[i] != null) {
cur.nexts[i].fail = curFail.nexts[i];
break;
}
curFail = curFail.fail;
}
queue.add(cur.nexts[i]);
}
}
}
}
public List<String> containWords(String content) {
char[] str = content.toCharArray();
int index = 0;
Node follow = root;
Node cur = root;
ArrayList<String> list = new ArrayList<>();
buildFail();
for (int i = 0; i < str.length; i++) {
index = str[i] - 'a';
while (cur.nexts[index] == null && cur != root) {
cur = cur.fail;
}
cur = cur.nexts[index] == null ? root : cur.nexts[index];
follow = cur;
while (follow != root) {
if (follow.endUse) {
break;
}
if (follow.end != null) {
for (int j = 0; j < cur.ends; j++) {
list.add(follow.end);
}
follow.endUse = true;
}
follow = follow.fail;
}
}
return list;
}
}
public static class InputReader {
private StringTokenizer st;
private BufferedReader bf;
public InputReader() {
bf = new BufferedReader(new InputStreamReader(System.in));
st = null;
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens()) {
st = new StringTokenizer(bf.readLine());
}
return st.nextToken();
}
public String nextLine() throws IOException {
return bf.readLine();
}
public int nextInt() throws IOException {
return Integer.parseInt(next());
}
public long nextLong() throws IOException {
return Long.parseLong(next());
}
public double nextDouble() throws IOException {
return Double.parseDouble(next());
}
public BigInteger nextBigInteger() throws IOException {
return new BigInteger(next());
}
public BigDecimal nextBigDecimal() throws IOException {
return new BigDecimal(next());
}
}
}