#P1738. Minimum Folder Creation

    ID: 15023 Type: Default 1000ms 256MiB

Minimum Folder Creation

Minimum Folder Creation

kkksc03 is a visionary dreamer who imagined countless webpage designs in a short time and then handed them to poor lzn to implement. In the web server, the folder structure can be deeply nested; for example, the path $\verb!/luogu/application/controller!$ represents that there is a folder named luogu in the root directory, which contains a folder named application, and inside that there is a folder named controller.

Each path always begins with /, never contains two consecutive / characters, and does not end with a /. All folder names consist solely of digits and lowercase letters. Initially, the root directory is empty.

Your task is to determine the minimum number of folder creation operations required so that all the suggested folders exist. If two or more paths share common subfolders, these subfolders only need to be created once.

Note: For each input path, you must consider every prefix directory (for example, for /a/b/c, the prefixes are /a and /a/b along with the full path).

inputFormat

The first line contains an integer n (1 ≤ n ≤ 105), representing the number of folder paths.

Each of the next n lines contains a string that represents a desired folder path.

outputFormat

Output a single integer denoting the minimum number of folder creation operations required.

sample

3
/luogu/application/controller
/luogu/contest/problem
/luogu/application/model
6

</p>