AT_past17_i 部分列ペア

Description

You are given $ N $ strings $ S_1,\ldots,S_N $ . Find the number of integer pairs $ (i,j) $ such that: - $ 1 \leq i,j \leq N $ , and - $ S_i $ is a subsequence of $ S_j $ . What is subsequence?A **subsequence** of a string is a string obtained by removing characters at zero or more positions and concatenating the remaining characters without changing their order. For example, `a`, `pe`, and `apple` are subsequences of `apple`, but `ea` and `hoge` are not.

Input Format

The input is given from Standard Input in the following format: > $ N $ $ S_1 $ $ \vdots $ $ S_N $

Output Format

Print the answer.

Explanation/Hint

### Sample Explanation 1 Among nine pairs of integers $ (i,j) $ such that $ 1 \leq i,j \leq N $ , the following five satisfy the condition that $ S_i $ is a subsequence of $ S_j $ . - $ (i,j)=(1,1) $ - $ (i,j)=(1,2) $ - $ (i,j)=(1,3) $ - $ (i,j)=(2,2) $ - $ (i,j)=(3,3) $ ### Constraints - $ 1 \leq N \leq 10^5 $ - $ N $ is an integer. - $ S_i $ is a string of length between $ 1 $ and $ 5 $ , inclusive, consisting of lowercase English letters.