Repetition#2718

Repetition

1 second
64 megabytes
Medium

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.

Input

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

Output a single integer — the length of the longest word that appears as a substring in each of the input words.

Examples

Example 1

Loading
Loading