Problems
Simple prefix compression
Simple prefix compression
Many databases store the data in the character fields (and especially indices) using prefix compression. This technique compresses a sequence of strings \textbf{A_1}, ..., \textbf{A_N} by the following method: if there are strings
\textbf{A_i = a_\{i,1\}a_\{i,2\}...a_\{i,p\}} and \textbf{A_\{i+1\} = a_\{i+1,1\}a_\{i+1,2\}...a_\{i+1,q\}}
such that for some \textbf{j} ≤ \textbf{min(p, q)} \textbf{a_\{i,1\} = a_\{i+1,1\}, a_\{i,2\} = a_\{i+1,2\}, ... a_\{i,j\} = a_\{i+1,j\}}, then the second string is stored as \textbf{\[j\]a_\{i+1,j+1\}a_\{i+1,j+2\}... a_\{i+1,q\}}, where \textbf{\[j\]} is a single character with code \textbf{j}.
If \textbf{j = 0}, that is, strings do not have any common prefix, then the second string is prefixed with zero byte, and so the total length actually increases.
\InputFile
First line of input file contains integer number \textbf{N} (\textbf{1} ≤ \textbf{N} ≤ \textbf{10000}), with following \textbf{N} lines containing strings \textbf{A_1}...\textbf{A_N} (\textbf{1 }≤ \textbf{length(A_i)} ≤ \textbf{255}).
\OutputFile
Output file must contain a single integer --- minimal total length of compressed strings.
Input example #1
3 abc atest atext
Output example #1
11