Given a sequence of words consisting of lowercase Latin letters, find the length of the longest word that occurs as a substring in each of the given words.
The first line contains a positive integer (1 \leq N \leq 5) — the number of words. Each of the following lines contains one word made up of lowercase Latin letters. Each word has length at least and at most .
Output a single integer — the length of the longest word that appears as a substring in each of the input words.
Example 1