A pair of strings is considered good if they have at least one common letter. For example, the pair abc and adc is good because they share the letters a and c. Conversely, the pair bc and def is not good because they have no common letters.
Given n strings, count the number of good string pairs.
Input:
4
abc
def
afg
ed
Output:
3