Croc Champ 2012 - Qualification Round
A
Phone Code
Codeforces
800
原题
←B →
翻译中…

Polycarpus has $*n*$ friends in Tarasov city. Polycarpus knows phone numbers of all his friends: they are strings $*s*_{1}, *s*_{2}, ..., *s*_{*n*}$. All these strings consist only of digits and have the same length.

翻译中…

Once Polycarpus needed to figure out Tarasov city phone code. He assumed that the phone code of the city is the longest common prefix of all phone numbers of his friends. In other words, it is the longest string $*c*$ which is a prefix (the beginning) of each $*s*_{*i*}$ for all $*i*$ ($1 ≤ *i* ≤ *n*$). Help Polycarpus determine the length of the city phone code.

翻译中…

Input

翻译中…

The first line of the input contains an integer $*n*$ ($2 ≤ *n* ≤ 3·10^{4}$) — the number of Polycarpus's friends. The following $*n*$ lines contain strings $*s*_{1}, *s*_{2}, ..., *s*_{*n*}$ — the phone numbers of Polycarpus's friends. It is guaranteed that all strings consist only of digits and have the same length from $1$ to $20$, inclusive. It is also guaranteed that all strings are different.

翻译中…

Output

翻译中…

Print the number of digits in the city phone code.

翻译中…

Note

翻译中…

A prefix of string $*t*$ is a string that is obtained by deleting zero or more digits from the end of string $*t*$. For example, string "00209" has 6 prefixes: "" (an empty prefix), "0", "00", "002", "0020", "00209".

翻译中…

In the first sample the city phone code is string "00".

翻译中…

In the second sample the city phone code is an empty string.

翻译中…

In the third sample the city phone code is string "770123456789".

翻译中…

样例

Input #1
4
00209
00219
00999
00909
Output #1
2
InputCopy OutputCopy
Input #2
2
1
2
Output #2
0
InputCopy OutputCopy
Input #3
3
77012345678999999999
77012345678901234567
77012345678998765432
Output #3
12
InputCopy OutputCopy
题目信息
题号
172A
时间限制
2 s
内存限制
256 MB
标签
*special
暴力
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。