In Aramic language words can only represent objects.

Words in Aramic have special properties:   A word is a root if it does not contain the same letter more than once.  A root and all its permutations represent the same object.  The root $x$ of a word $y$ is the word that contains all letters that appear in $y$ in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".  Any word in Aramic represents the same object as its root. 

You have an ancient script in Aramic. What is the number of different objects mentioned in the script?


-----Input-----

The first line contains one integer $n$ ($1 \leq n \leq 10^3$) — the number of words in the script.

The second line contains $n$ words $s_1, s_2, \ldots, s_n$ — the script itself. The length of each string does not exceed $10^3$.

It is guaranteed that all characters of the strings are small latin letters.


-----Output-----

Output one integer — the number of different objects mentioned in the given ancient Aramic script.


-----Examples-----
Input
5
a aa aaa ab abb

Output
2
Input
3
amer arem mrea

Output
1


-----Note-----

In the first test, there are two objects mentioned. The roots that represent them are "a","ab".

In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".

Difficulty: interview

Starter code:

Solutions:
n = int(input())
a = set(''.join(sorted(set(v))) for v in input().split())

print(len(a))


input()
print(len(set(tuple(sorted(list(set(x)))) for x in input().split())))


def ii():
    return int(input())
def mi():
    return map(int, input().split())
def li():
    return list(mi())

n = ii()
s = [frozenset(x) for x in input().split()]
s = set(s)
print(len(s))

input()
a = input().split()
x = set()
for i in a:
    x.add(str(set(sorted(list(i)))))
    
print(len(x))

n = int(input())
s = set()
w = [frozenset(x) for x in input().split()]
for i in range(n):
    s.add(w[i])
print(len(s))

n = int(input())
a = list(input().split())
for i in range(n):
	a[i] = ''.join(sorted(list(set(a[i]))))
print(len(set(a)))

n = int(input())

ws = set("".join(sorted(set(w))) for w in input().split())

print(len(ws))

n=int(input())
se=input().split()
st=set()
for x in range(n):
    s=se[x]
    s=set(s)
    st.add(tuple(sorted(list(s))))
print(len(st))

n = int(input())

s = input().split()

res = set()

for i in s:
    res.add(''.join(sorted(set(i))))

print(len(res))

import atexit
import io
import sys

# Buffering IO
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
    sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
    

def main():
    n = int(input())
    ss = input().split()
    s = set()
    for x in ss:
        s.add(''.join(sorted(list(set(x)))))
    print(len(s))
        
            

    
def __starting_point():
    main()

__starting_point()

n = int(input())
arr = set(tuple(sorted(set(x))) for x in input().split())
print(len(arr))


n = int(input())
s = list(map(set, input().split()))
final = []
for i in s:
    for j in final:
        if i == j:
            break
    else:
        final.append(i)
print(len(final))


n = int(input())
rec = []
p = list(input().split())
for i in range(n):
    a = list(p[i])
    a = sorted(a)
    s = sorted(list(set(a)))
    if s not in rec:
        rec.append(s)

print(len(rec))

n = input()
a = list(input().split())
import string
def rt(s):
    al = string.ascii_lowercase
    d = set()
    for l in s:
        d.add(l)
    return ''.join(sorted(list(d)))
s = set()
for w in a:
    s.add(rt(w))
print(len(s))

from sys import stdin, stdout
from math import factorial
from math import log10

n = int(stdin.readline())
s = set()

q = stdin.readline().strip().split()

for i in range(n):
    f = ''.join(sorted(list(set(list(q[i])))))
    s.add(f)

stdout.write(str(len(s)))

n = int(input())
lns = input().split()
ans = set()
for ln in lns:
    ans.add(''.join(sorted(set(ln))))
print(len(ans))

n = int(input())

words = set()
ss = input().split()
for s in ss:
    w = frozenset(s)
    words.add(w)

print(len(words))

n = int(input())
a = list(input().split())
st = []
for i in a:
    tmp = set()
    for j in i:
        tmp.add(j)
    if tmp not in st:
        st.append(tmp)

print(len(st))


def main():
    n = int(input())
    ss = [i for i in input().split(' ')]

    nss = []
    for i in range(len(ss)):
        arr = []
        for c in ss[i]:
            if not c in arr:
                arr.append(c)
        arr.sort()
        ns = ''.join(arr)
        
        if not ns in nss:
            nss.append(ns)

    print(len(nss))

main()


# cook your dish here
# from math import * 
n =int(input())
ss = set()
l = input().split()
#print(l)
for s in l:
    ss.add(''.join(sorted(str(set(s)))))
print(len(ss))

n = input()
roots = set(tuple(sorted(set(w))) for w in input().split())
print(len(roots))


n = int(input())
a = list(map(str, input().split()))
for i in range(n):
    q = set()
    for j in range(len(a[i])):
        q.add(a[i][j])
    q = list(q)
    q.sort()
    a[i] = q
s = set()
for i in range(n):
    s.add("".join(a[i]))
print(len(s))

_ = input()
s = set()

for x in input().split():
    x = list(set(tuple(x)))
    x.sort()
    s.add(tuple(x))

print(len(s))