You are given n distinct words. A word is a compound token if it can be split into two or more parts, in order, where every part is a word that appears in the list. Parts may repeat, and each part must be a word from the list; since there are at least two parts, each part is strictly shorter than the whole word.
Count how many of the given words are compound tokens. All words consist of lowercase English letters only.
Input format
Line 1: an integer n.
Line 2: n space-separated distinct words.
Output format
A single integer: the number of compound tokens.
Constraints
- 1 <= n <= 5000
- Each word has length 1..40, lowercase letters.
- The words are distinct.