Chain of words#2190

Chain of words

1 second
64 megabytes
Very easy

A word chain of length is defined as a sequence of words w_1, w_2, \ldots, w_n such that for every 1 \leq i < n, the word w_i is a proper prefix of the word w_{i+1}.

Recall that a word of length is called a proper prefix of a word of length if l > k and the first letters of are the same as .

Given a set of words S = \{s_1, s_2, \ldots, s_m\}, find the maximum length of a word chain that can be formed using some (possibly not all) words from this set.

Input

The first line contains an integer (1 \leq m \leq 255). Each of the next lines contains one word from the set .

All words are non-empty, have length at most , and consist only of lowercase Latin letters.

Output

Output the answer to the problem.

Examples

Example 1

Loading
Loading