Given a function f(s,t) which takes two string s and t as input. Without loss of generality that |s|≤|t|, let's say the output of the function is as follow:
f(s,t)=⎧⎨⎩0,if s is a prefix of t.the first position where s and t differ,otherwise.
For example, f(abc,abd)=3.
Given a n string Si. Calculate:
n∑i=1n∑j=i+1f(Si,Sj)
### Input
- The first line contains an integer n.
- The next n lines, each line contains a string Si, each string contains only lowercase letters.
### Output
- Print the value.
### Constraints
- 1≤n≤105.
- 1≤∑|Si|≤106
### Example
Input:
4catˆmatsir
Output:
6