Two words share the same structural pattern if, reading left to right and replacing each character by the index (starting at 0) at which its letter first appeared within that word, the resulting sequences of indices are identical. For example, abba becomes 0 1 1 0, and xyyx also becomes 0 1 1 0 — so abba and xyyx share the same pattern even though they use different letters. aabb becomes 0 0 1 1, a different pattern.
Given n lowercase words, group them by this structural-pattern equivalence and print the number of distinct groups.
Input format
Line 1: an integer n.
Line 2: n space-separated lowercase words.
Output format
A single integer: the number of distinct structural-pattern groups among the n words.
Constraints
- 1 ≤ n ≤ 200
- Each word has length 1-15 and consists of lowercase English letters only.