The Queen of Nlogonia has decided to move the capital of the queendom to a brand new city called Sortonia. The design for the city is an $N \times N$ grid consisting of $N$ avenues running in the North-South direction and $N$ streets running in the East-West direction. Thus, each avenue intersects every street, and no two streets or two avenues intersect each other.

As the city is almost finished, it is now time to assign names to its streets and avenues. The people of Nlogonia have already voted on the $2 \times N$ names that they want to use, but it hasn’t been decided yet which of those will be used for the streets and which for the avenues. The issue is not so simple, because in each crossing there should be a sign identifying the street and the avenue that intersect there, and the Queen has expressly ordered that the letters in these signs ought to be written in gold encrusted with rubies.

Being the official Accountant who Counts the Money (ACM), it is your task to find a way to minimize the total number of letters written in the crossings’ signs, for obvious reasons. Luckily, you have thought of a very clever way to achieve this, which is to use abbreviations for the names of the streets and avenues in the signs. The abbreviation for the name of an avenue (respectively a street) is the shortest prefix of its name which is not a prefix of the name of any other avenue (respectively street). Of course, the abbreviation to be used for each name depends on how the set of $2 \times N$ names is split in two disjoint sets of $N$ names to be used for the streets and avenues.

For example, consider the case with $N = 2$ where the four chosen names are $\texttt{GAUSS}$, $\texttt{GALOIS}$, $\texttt{ERDOS}$ and $\texttt{EULER}$. If the streets are assigned the names $\texttt{GAUSS}$ and $\texttt{GALOIS}$, whereas the avenues are assigned the names $\texttt{ERDOS}$ and $\texttt{EULER}$, then the abbreviations would be $\texttt{GAU}$ for $\texttt{GAUSS}$, $\texttt{GAL}$ for $\texttt{GALOIS}$, $\texttt{ER}$ for $\texttt{ERDOS}$ and $\texttt{EU}$ for $\texttt{EULER}$. With this splitting, the total number of letters to be written in the signs would be $20$, as the four intersections would be labeled by $\texttt{GAU|ER}$, $\texttt{GAU|EU}$, $\texttt{GAL|ER}$ and $\texttt{GAL|EU}$.

However, in the example above it would be more convenient to assign the streets the names $\texttt{GAUSS}$ and $\texttt{ERDOS}$, leaving $\texttt{GALOIS}$ and $\texttt{EULER}$ for the avenues. Then, the abbreviations would be $\texttt{G}$ for $\texttt{GAUSS}$, $\texttt{E}$ for $\texttt{ERDOS}$, $\texttt{G}$ for $\texttt{GALOIS}$ and $\texttt{E}$ for $\texttt{EULER}$, and the total number of letters to be written in the signs would be just $8$ (as the intersections would be labeled by $\texttt{G|G}$, $\texttt{G|E}$, $\texttt{E|G}$ and $\texttt{E|E}$).

Fortunately, the set of names that has been chosen is such that no name in it is a prefix of some other name in the set, thereby ensuring that the scheme you propose will always be feasible. Can you calculate the minimum number of letters to be written in the signs if you split the names optimally?

The first line contains an integer $N$ ($2 \leq N \leq 100$) representing both the number of streets and the number of avenues in Sortonia. Each of the next $2 \times N$ lines contains a non-empty string of at most $18$ uppercase letters, indicating one of the names that have been chosen. You may assume that none of the given strings is a prefix of another string in the input.

Output a line with an integer representing the minimum total number of letters to be written in the signs, when the splitting of the names of streets and avenues is chosen optimally.

Input

2
GAUSS
GALOIS
ERDOS
EULER

Output

8

Input

4
AA
AB
AC
AD
BA
BB
BC
BD

Output

56