Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

The following languages are only available languages for the problems from the contest

Friday the 13th, Programmers Day:

- Ada GNAT 4

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

G. Suffix Subgroup

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given a group of *n* strings: *s*_{1}, *s*_{2}, ..., *s*_{n}.

You should find a subgroup *s*_{i1}, *s*_{i2}, ..., *s*_{ik} (1 ≤ *i*_{1} < *i*_{2} < ... < *i*_{k} ≤ *n*) of the group. The following two conditions must hold:

- there exists a string
*t*such, that each string from found subgroup is its suffix; - the number of strings in the found subgroup is as large as possible.

Your task is to print the number of strings in the found subgroup.

Input

The first line contains an integer *n* (1 ≤ *n* ≤ 10^{5}) — the number of strings in the group. Each of the next *n* lines contains a string. The *i*-th line contains non-empty string *s*_{i}.

Each string consists only from lowercase Latin letters. The sum of all strings *s*_{i} doesn't exceed 10^{5}.

Output

Output a single integer — the number of strings in the found subgroup.

Examples

Input

6

bb

bb

b

aaa

aa

z

Output

3

Note

Look at the test sample. The required subgroup is *s*_{1}, *s*_{2}, *s*_{3}.

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/10/2018 12:55:26 (d1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|