Dictionary Size

The government of Disleksik Piple’s Ripublyc had decided to improve literacy level of its citizens. To this end, the government issued a decree with a full list of dictionary words. The rules for construction of new words were also greatly simplified: an approved word must either be a dictionary word or consist of two parts, where the first part must be a dictionary word or its non-empty prefix, and the second part — a dictionary word or its non-empty suffix. The Institute of Language Simplification has assigned you the task to count the number of different approved words that can be constructed from the given dictionary. Input The input will contain several test cases, each of them as described below. The first line of the input file contains the number of dictionary words n (1 ≤ n ≤ 10000). The following n lines contain dictionary words, one word per line. Dictionary words are composed of lowercase Latin letters and are at least 1 and at most 40 letters in length. The Institute of Language Simplification did not necessary do a good job of cleaning the input data, so their list may contain duplicates. Output For each test case, write to the output on a line by itself. The output file must contain a single integer — the number of different approved words. Sample Input 3 abc def abef Sample Output 60