N. Auto-completion
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

The creators of the operating system "X" relied on working in the terminal and included the SuperShell shell in the distribution package.

While working in SuperShell, one can enter the name of the necessary file character by character or use Tab for automatic completion.

Pressing the Tab key works as follows. Let's consider a subset of directory file names whose prefix matches the line already written in SuperShell. As a result of pressing Tab, the written line will be expanded to the maximum length of the common prefix among the files in this subset.

Freddy — one of the developers "X" — tested the shell and, once in the directory with logs, wondered what the minimum number of characters would need to be typed on the keyboard to open the desired file. Pressing Tab is also considered entering a character.

Input

The first line contains the number $$$N$$$ ($$$1 \le N \le 2000$$$) — the number of files in the directory.

This is followed by $$$N$$$ lines, each contains the line $$$f_i$$$ ($$$1 \le i \le N$$$, $$$1 \le |f_i| \le 2000$$$), consisting of lowercase Latin letters — filenames in the directory. Moreover, the file Freddy needs is listed first.

Output

Output one number — the minimum number of keypresses that Freddy will need.

Example
Input
4
bacb
ab
baca
caa
Output
3
Note

To open the required file from the example, Freddy just needs to click: $$$b$$$ —Tab — $$$b$$$.