Time limit
2s
Memory limit
128 MB
A set of words is prefix-free if no word in the set is a prefix of another word in the same set. For example, {hello}, {hello, goodbye, giant, hi}, and the empty set are all prefix-free. However, {hello, hell} and {giant, gig, g} are not prefix-free.
Given a collection of N words, find the maximum possible size of a subset that is prefix-free.
The first line contains the number of words N. N is a positive integer not greater than 50.
Each of the next N lines contains one word. Every word consists only of lowercase English letters and has length at most 50. The same word may appear more than once in the given collection.
Print the answer on the first line.