The 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, a solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then the 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 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

The problem statement has recently been changed. View the changes.

×
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-2022 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/30/2022 19:56:46 (g2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|