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: EASY
Tags: String algorithms

Implementation

Starter code:

Solutions:
n = int(input())
s = input().split()
print(len(set((frozenset(si) for si in s))))


class AramicWord(object):

	def __init__(self, word):
		self._word = word
		self._root = set(word)

	def get_root(self):
		return ''.join(sorted(set(self._root)))

	def get_word(self):
		return self._word

def AramicScript():
	n = int(input().strip())
	words = input().strip().split()
	for i in range(n):
		words[i] = AramicWord(words[i]).get_root()
	return len(set(words))
a = AramicScript()
print(a)


n = int(input())
words = input().split(' ')
mySet = set()
for i in words:
	l = list(i)
	l.sort()
	ts = {item for item in l}
	mySet.add(str(ts))
print(len(mySet))


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


n = int(input())
x = list(input().split())
ans = []
for i in range(n):
	y = list(x[i].strip())
	y.sort()
	y = set(y)
	y = ''.join(y)
	if y in ans:
		pass
	else:
		ans.append(y)
print(len(ans))


n = int(input())
a = input().split()
ans = []
for i in a:
	ioi = ''
	for j in i:
		if j not in ioi:
			ioi += j
	ioi = list(ioi)
	ioi.sort()
	if ioi not in ans:
		ans.append(ioi)
print(len(ans))


n = int(input())
A = input().split()
final = {}
for st in A:
	count = {}
	for j in st:
		if count.get(j, 0) == 0:
			count[j] = 1
	count = sorted(list(count))
	key = ''.join(count)
	if final.get(key, 0) == 0:
		final[key] = 1
print(len(final))


input()
print(len({tuple(sorted(set(w))) for w in input().split()}))


import sys

def read(func=int):
	return func(sys.stdin.readline().strip())

def readList(func=int):
	return list(map(func, sys.stdin.readline().split()))
dic = set()
n = read()
S = readList(str)
for word in S:
	chars = set()
	for char in word:
		chars.add(char)
	s = ''.join(sorted([x for x in chars]))
	dic.add(s)
print(len(dic))


from copy import *
n = int(input())
arr = list(map(str, input().split()))
arrx = []
arrz = [0] * 26
for i in range(n):
	k = copy(arrz)
	arrx.append(k)
for i in range(n):
	x = ''
	for j in arr[i]:
		if j not in x:
			arrx[i][ord(j) - 97] = 1
			x += j
arry = []
ans = 0
for i in arrx:
	if i not in arry:
		arry.append(i)
		ans += 1
print(ans)


n = int(input())
x = list(map(str, input().split(' ')))
a = []
for i in range(n):
	if sorted(set(x[i])) not in a:
		a.append(sorted(set(x[i])))
print(len(a))


n = int(input())
print(len(set(map(frozenset, input().split()))))


import math
import string

def RAC(a):
	if a == '':
		return a
	b = ''
	for i in a:
		if b == '':
			b += i
		if b.find(i) != -1:
			pass
		else:
			b += i
	return b
n = int(input())
s = str(input()).split()
ta = []
ans = 0
fuck = []
for i in range(0, n):
	tmp = RAC(s[i])
	for j in tmp:
		ta.append(j)
	ta.sort()
	tmp = ''
	tmp = tmp.join(ta)
	ta.clear()
	if fuck.__contains__(tmp):
		pass
	else:
		fuck.append(tmp)
		ans += 1
print(ans)


from collections import OrderedDict
n = int(input())
l = list(map(str, input().split()))
for i in range(0, n):
	l[i] = ''.join(OrderedDict.fromkeys(sorted(l[i])))
l = list(dict.fromkeys(l))
print(len(l))


def main():
	n = int(input())
	S = []
	s = input().split()
	S.append(set(s[0]))
	count = 1
	for i in range(1, n):
		if set(s[i]) not in S:
			S.append(set(s[i]))
			count += 1
	print(count)
main()


import copy
e = int(input())
a = set(input().split())
print(len(set([''.join(sorted(list(set(x)))) for x in a])))


n = int(input())
arr = map(str, input().split())
d = {}
for ele in arr:
	a = set(ele)
	s = sorted(a)
	k = ''
	for item in s:
		k += item
	d[k] = d.get(k, 0) + 1
print(len(d))


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


n = int(input())
a = list(input().split())
b = []
for i in range(n):
	p = []
	for j in range(len(a[i])):
		if not a[i][j] in p:
			p.append(a[i][j])
	p.sort()
	pp = ''
	for ele in p:
		pp += ele
	if not pp in b:
		b.append(pp)
print(len(b))


ro = []
a = input()
ar = input().split()
for i in range(len(ar)):
	r = ''
	for j in range(len(ar[i])):
		if not ar[i][j] in r:
			r += ar[i][j]
	r = ' '.join(r).split()
	r.sort()
	r = ''.join(r)
	if not r in ro:
		ro.append(r)
print(len(ro))


n = int(input())
ss = input().split()
print(len(set(map(lambda s: ''.join(sorted(list(set(s)))), ss))))


n = int(input())
a = list(input().split())
f = [[0] * 26 for i in range(n)]
for i in range(n):
	for j in range(len(a[i])):
		f[i][ord(a[i][j]) - ord('a')] = 1
k1 = 0
for i in range(n):
	a[i] = ''
	for j in range(26):
		if f[i][j]:
			a[i] += str(ord('a') + j)
a.sort()
a = ['0'] + a
i = 1
while i < len(a):
	if a[i] == a[i - 1]:
		a = a[:i - 1] + a[i:]
	else:
		i += 1
print(len(a) - 1)


n = int(input())
strings = input().split()
l = set()
for string in strings:
	rep = ''.join(set(string))
	rep = ''.join(sorted(rep))
	l.add(rep)
print('{}'.format(len(l)))


n = int(input())
S = input().split()
roots = set()
for s in S:
	t = tuple(sorted(list(set(s))))
	roots.add(t)
r = len(roots)
print(r)


n = input()
s = list(map(str, input().split()))
l = []
for i in s:
	l.append(frozenset(set(i)))
print(len(set(l)))


input()
inp = input().split()

def root(w):
	return ''.join(sorted(set(w)))
roots = {}
for w in inp:
	r = root(w)
	if r in roots:
		continue
	roots[r] = 1
print(len(roots))


(n, b, c) = (int(input()), [], 0)
for i in input().split():
	a = set()
	for j in i:
		a.add(j)
	if a not in b:
		b.append(a)
		c += 1
print(c)


input()
x = map(lambda x: repr(set(sorted(x))), input().split())
print(len(set(x)))


n = int(input())
string = list(map(str, input().split()))

def make_seri(word):
	seri = ''
	for i in range(26):
		if word.find(chr(ord('a') + i)) >= 0:
			seri += '1'
		else:
			seri += '0'
	return seri
dic = set()
for i in range(n):
	temp = make_seri(string[i])
	dic.add(temp)
print(len(dic))


a = int(input())
t = list(input().split())
p = []
for k in t:
	b = list(set(list(k)))
	b.sort()
	p.append(''.join(b))
print(len(set(p)))


n = int(input())
a = list(input().split())
b = []
for i in range(len(a)):
	c = []
	for j in a[i]:
		if not j in c:
			c.append(j)
	c.sort()
	if not c in b:
		b.append(c)
print(len(b))


n = int(input())
s = input().split()
used = []
dic = []
ans = 0
for word in s:
	root = ''
	for i in range(97, 97 + 26):
		c = chr(i)
		if c in word:
			root += c
	if not root in dic:
		ans += 1
		dic.append(root)
print(ans)


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


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


n = int(input())
l = input().split()
s = []
for i in l:
	t = list(set(i))
	t.sort()
	s.append(''.join(t))
print(len(set(s)))


n = input()
s = input()
res = set()
r = set()
for l in s:
	if l == ' ':
		r = sorted(r)
		res.add(''.join(r))
		r = set()
	else:
		r.add(l)
r = sorted(r)
res.add(''.join(r))
print(len(res))


def f(s):
	c = set(s)
	return ''.join(sorted(c))
n = int(input())
li = input().split()
d = {}
for i in li:
	k = f(i)
	if k in d:
		d[k] += 1
	else:
		d[k] = 1
print(len(d))


n = int(input())
a = input().split()
myset = set()
for x in a:
	root = ''.join(sorted(list(set(x))))
	myset.add(root)
print(len(myset))


from collections import Counter
n = int(input())
s = input()
ans = 0
keys = {}
words = s.split()
for word in words:
	c = Counter(word)
	key = ''.join(sorted(c.keys()))
	if key not in keys:
		keys[key] = 1
		ans += 1
print(ans)


n = int(input())
s = input().split()
b = []
for i in s:
	x = sorted(set(i))
	y = ''.join(x)
	b.append(y)
print(len(set(b)))


t = int(input())
l = list(input().split())
a = set()
for j in range(t):
	y = list(set(list(l[j])))
	y.sort()
	x = ''.join(y)
	a.add(x)
print(len(a))


import sys
import math
n = int(input())
cota = [str(0) for i in range(26)]
lista = []
seta = set()
stra = [str(x) for x in input().strip().split()]
for s in stra:
	suma = 0
	cota = [str(0) for i in range(26)]
	for i in range(len(s)):
		cota[ord(s[i]) - ord('a')] = str(1)
	stry = ''.join(cota)
	seta.add(stry)
print(len(seta))


n = int(input())
a = [sorted(list(set(x))) for x in input().split()]
b = []
for x in a:
	x_was_not = True
	if len(b) == 0:
		b.append(x)
	else:
		for y in b:
			if set(x) == set(y):
				x_was_not = False
	if x_was_not:
		b.append(x)
print(len(b) - 1)


n = int(input())
a = list(input().split())
rs = set()
for i in a:
	t = set()
	for j in i:
		t.add(j)
	temp = ''
	t = sorted(t)
	for j in t:
		temp += j
	rs.add(temp)
print(len(rs))


from itertools import groupby
n = int(input())
l = [str(x) for x in input().split()]
ll = []
if n == 1:
	print(1)
else:
	for i in range(n):
		temp = ''.join((k for (k, g) in groupby(sorted(l[i]))))
		ll.append(temp)
	print(len(list(set(ll))))


import math
import sys
import re
n = int(input())
l = input().split(' ')
l1 = []
for x in l:
	y = set(list(sorted(x)))
	if y not in l1:
		l1.append(y)
print(len(l1))


n = int(input())
manuscript = []
manuscript = input().split()
words = []
for s in manuscript:
	word = ''
	array = []
	for i in range(len(s)):
		if s[i] not in array:
			array.append(s[i])
	array.sort()
	for j in array:
		word = word + j
	if word not in words:
		words.append(word)
print(len(words))


n = int(input())
w = set([])
l = input().split()
for word in l:
	root = set(word)
	root = list(root)
	root.sort()
	root = ''.join(root)
	w.add(root)
print(len(w))


n = int(input())
s = input().split()
args = []
for i in s:
	x = list(i)
	x = set(x)
	if x not in args:
		args.append(x)
print(len(args))


t = str(input())
arr = [frozenset(x) for x in input().split()]
print(len(set(arr)))


n = int(input())
lst2 = []
list = input().split(' ')
for i in range(0, n):
	s = list[i]
	s = sorted(s)
	l = len(s)
	lst3 = []
	for j in range(0, l):
		if s[j] not in lst3:
			lst3.append(s[j])
	s = ''.join(lst3)
	if s not in lst2:
		lst2.append(s)
length = len(lst2)
print(length)


def root(word):
	chars = list(dict.fromkeys([c for c in word]))
	chars.sort()
	return ''.join(chars)

def main():
	input()
	words = input().split()
	word_dict = {}
	for word in words:
		word_dict[root(word)] = True
	print(len(word_dict))
main()


n = int(input())
arr = input().strip().split()
arr = [str(sorted(set(i))) for i in arr]
arr = set(arr)
print(len(arr))


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


n = int(input())
A = input().split()
h = 0
z = []
for j in A:
	if set(j) not in z:
		z.append(set(j))
		h += 1
print(h)


n = int(input())
a = list(input().split())
b = []
for i in a:
	x = list(set(i))
	x.sort()
	b.append(''.join(x))
print(len(set(b)))


n = int(input())
s = list(input().split())
t = set()
for i in s:
	k = len(i)
	c = 0
	for j in range(k):
		c = c | 1 << ord(i[j]) - ord('a')
	t.add(c)
print(len(t))


n = int(input())
A = list(input().split())
cnt = 1
if n == 1:
	print(cnt)
else:
	B = [sorted(list(set(i))) for i in A]
	B = sorted(B)
	for i in range(1, len(B)):
		if B[i] != B[i - 1]:
			cnt += 1
	print(cnt)


n = int(input())
li = list(input().split())
s = set()
c = 0
for i in li:
	l = list(set(i))
	l.sort()
	l = ''.join(l)
	if l not in s:
		s.add(l)
		c = c + 1
print(c)


input()
b = []
for i in list(input().split()):
	x = set(list(i))
	if x not in b:
		b.append(x)
print(len(b))


n = int(input())
words = input().split()
roots = {}
for word in words:
	if not roots.get(frozenset(word)):
		roots[frozenset(word)] = 1
print(len(roots.keys()))


def objects(n):
	ans = []
	for x in n:
		q = list(set(x))
		if len(ans) == 0:
			ans.append(q)
		else:
			for i in ans:
				k = 0
				if len(i) == len(q):
					for j in q:
						if j not in i:
							k = 1
							break
					if k == 0:
						break
				else:
					k = 1
			if k == 1:
				ans.append(q)
	return len(ans)
t = int(input())
n = input().split()
print(objects(n))


n = int(input())
p = list(map(str, input().split()))
fr = []
for it in p:
	tam = list(set(it))
	tam.sort()
	fr.append(''.join(tam))
print(len(set(fr)))


def mapping(word):
	mapp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
	j = 0
	for i in ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']:
		if i in word:
			mapp[j] += 1
		j += 1
	return mapp
n = int(input())
pismo = list(map(mapping, list(map(list, input().split()))))
ans = []
for i in pismo:
	if i not in ans:
		ans.append(i)
print(len(ans))


input()
d = {frozenset(s) for s in input().split()}
print(len(d))


try:
	n = int(input())
	l = list(map(str, input().split()))
	l1 = []
	for i in range(len(l)):
		s = set(l[i])
		st = ''.join(s)
		st = sorted(st)
		if l1.count(st) == 0:
			l1.append(st)
	print(len(l1))
except EOFError:
	pass


n = int(input())
ss = input().split()
ans = 0
ds = []
for s in ss:
	d = set()
	for w in s:
		if not w in d:
			d.add(w)
	ws = sorted(list(d))
	if not ws in ds:
		ds.append(ws)
		ans += 1
print(ans)


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()


def repeat(string):
	string_temp = ''
	for i in string:
		if i not in string_temp:
			string_temp += i
	return string_temp
n = int(input())
num = list(map(str, input().split()))
sorted_num = []
c = 0
for i in num:
	a = repeat(i)
	b = ''.join(sorted(a))
	if b not in sorted_num:
		c += 1
		sorted_num.append(b)
print(c)


n = input()
o = 0
od = {}
for w in input().split():
	s = {}
	sw = ''
	for c in w:
		if s.get(c) is None:
			s[c] = 1
			sw += c
	ss = [c for c in sw]
	ss.sort()
	ss = ''.join(ss)
	if od.get(ss) is None:
		od[ss] = 1
		o += 1
print(o)


input()
a = len(set(map(frozenset, input().split())))
print(a)


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


n = int(input())
s0 = input().split()
s = []
s2 = []
for i in range(n):
	s1 = s0[i]
	s.append(list(set(s1)))
for i in range(len(s)):
	d = ''
	s[i].sort()
	for j in range(len(s[i])):
		d += s[i][j]
	s2.append(d)
s2 = list(set(s2))
print(len(s2))


n = int(input())
l = list(map(set, input().split(' ')))
s = list()
for i in l:
	if not i in s:
		s.append(i)
print(len(s))


n = int(input())
s = input().split()
ans = set()
d = 'abcdefghijklmnopqrstuvwxyz'
for i in s:
	ans.add(frozenset(i))
print(len(ans))


n = input()
s = input().split()
a = set()
list = []
for i in s:
	if set(i) not in list:
		list.append(set(i))
print(len(list))


n = int(input())
a = input()
arr = []
for i in range(n - 1):
	arr.append(set(a[:a.find(' ')]))
	a = a[a.find(' ') + 1:]
arr.append(set(a))
for i in range(n):
	arr[i] = list(arr[i])
	arr[i].sort()
	arr[i] = ''.join(arr[i])
arr = set(arr)
print(len(arr))


input()
k = set()
for s in input().split():
	k.add(frozenset(s))
print(len(k))


n = int(input())
s = input().split()
for i in range(n):
	s[i] = str(sorted(set(s[i])))
print(len(set(s)))


n = int(input())
str = input().split()
s = set()
for w in str:
	v = 0
	for c in w:
		v |= 1 << ord(c) - ord('a')
	s.add(v)
print(len(s))


input()
m = input().split()
lis = []
for i in m:
	lis.append(''.join(sorted(list(set(i)))))
print(len(set(lis)))


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()
w = input().split()
objs = []
for t in w:
	r = str(sorted(set(t)))
	if r not in objs:
		objs.append(r)
print(len(objs))


def s(a):
	la = []
	for i in range(len(a)):
		if not a[i] in la:
			la.append(a[i])
	return la
n = int(input())
l = input().split()
se = []
for i in range(n):
	k = s(l[i])
	k.sort()
	if not k in se:
		se.append(k)
print(len(se))


from sys import stdin

def solve(tc):
	n = int(stdin.readline().strip())
	ls = stdin.readline().split()
	dic = {}
	for s in ls:
		s = tuple(sorted(set(s)))
		if s in dic:
			dic[s] += 1
		else:
			dic[s] = 1
	print(len(dic))
	pass
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip()) if LOCAL_TEST else 1
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


n = int(input())
T = input().split(' ')
S = [-42]
dico = {}
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(len(alpha)):
	dico[alpha[i]] = i
for i in range(len(T)):
	m = T[i]
	L = [0] * 26
	for j in range(len(m)):
		L[dico[m[j]]] += 1
	tot = 0
	for k in range(len(L)):
		if L[k] >= 1:
			tot += 2 ** k
	S.append(tot)
S.sort()
num = 0
for i in range(1, len(S)):
	if S[i] != S[i - 1]:
		num += 1
print(num)


n = int(input())
a = list(input().split())
ans = 0
c = [0] * n
b = {}
for i in range(n):
	b = set(a[i])
	b = list(b)
	b.sort()
	if b not in c:
		c[i] = b
		ans += 1
print(ans)


n = int(input())
words = input().strip().split()
d = []
for word in words:
	if set(word) not in d:
		d.append(set(word))
print(len(d))


n = int(input())
have = []
for word in input().split():
	root = set(word)
	if root not in have:
		have.append(root)
print(len(have))


n = int(input())
l = map(lambda a: str(sorted(list(set(a)))), input().split())
print(len(set(l)))


n = int(input())
se = set()
arr = list(map(str, input().split()))
for i in range(n):
	m = [0] * 30
	s = arr[i]
	for j in s:
		m[ord(j) - ord('a')] = 1
	s2 = ''
	for j in m:
		s2 += str(j)
	se.add(s2)
print(len(se))


n = int(input())
text = input()
words = text.split(' ')
ans = set()
for word in words:
	ans.add(''.join(sorted(list(set(word)))))
print(len(ans))


n = int(input())
A = input().split()
an = 0
se = set()
for a in A:
	a = set(list(a))
	a = list(a)
	a.sort()
	se.add(''.join(a))
print(len(se))


a = int(input())
respuesta = set()
lista = list(input().split())
for i in range(a):
	respuesta.add(str(sorted(set(lista[i]))))
print(len(respuesta))


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


import sys
n = int(sys.stdin.readline())
tokens = sys.stdin.readline().rstrip().split(' ')
hist = {}
for tok in tokens:
	s = set(tok)
	a = sorted(s)
	k = ''.join(a)
	hist[k] = 1
print(len(hist))


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))


roots = []
lenght = []
n = int(input())
words = [i for i in input().split()]
for i in range(len(words)):
	a = sorted(set(words[i]))
	str1 = ''
	for j in a:
		str1 += j
	if str1 not in roots:
		roots.append(str1)
		lenght.append(len(str1))
	str1 = ''
print(len(roots))


input()
s = input()
m = []
for i in s.split():
	m.append(frozenset(i))
print(len(set(m)))


input()
print(len(list(set(list(map(frozenset, list(map(str, input().split(' ')))))))))


num = int(input())
arr = list(input().split())
st = set()
for word in arr:
	st.add(str(set(sorted(word))))
print(len(st))


n = int(input())
s = set()
a = input().split()
for j in a:
	f = ['0'] * 26
	for l in j:
		f[ord(l) - 97] = '1'
	st = ''.join(f)
	s.add(st)
print(len(s))


n = int(input())
a = list(map(str, input().split()))
b = []
count = 0
for i in range(n):
	if set(a[i]) not in b:
		count += 1
		b.append(set(a[i]))
print(count)


import sys
import math
import bisect
import itertools
import random

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


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


n = int(input())
h = input().split()
l = []
for i in range(n):
	s = set()
	k = len(h[i])
	for j in range(k):
		s.add(h[i][j])
	if s not in l:
		l.append(s)
print(len(l))


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


def j(x):
	return ''.join(list(x))

def d(x):
	return frozenset(list(x))
input()
print(len(list(set(list(map(frozenset, list(map(j, input().split(' ')))))))))


n = int(input())
s = input().split(' ')
ans = len(set([''.join(set(sorted(list(word)))) for word in s]))
print(ans)


n = int(input())
l = list(map(lambda x: tuple(sorted(set(x))), input().split()))
a = set()
for i in l:
	a.add(''.join(i))
print(len(a))


n = int(input())
s = input()
a = s.split()
roots = []
for i in range(len(a)):
	root = ''.join(sorted(set(a[i])))
	roots.append(root)
ans = set(roots)
print(len(ans))


n = int(input())
s = list(input().split(' '))
b = []
for word in s:
	b.append(set(word))
d = []
for k in b:
	temp = list(k)
	temp.sort()
	d.append(''.join(temp))
e = list(set(d))
print(len(e))


def manuscript(lst):
	w = set()
	for elem in lst:
		w.add(''.join(sorted(set(elem))))
	return len(w)
n = int(input())
words = input().strip().split()
print(manuscript(words))


n = int(input())
l = []
l.extend(input().split())
s = []
c = 0
for i in l:
	x = set(i)
	c = list(x)
	s.append(str(sorted(c)))
x = set(s)
print(len(x))


def solve():
	n = int(input())
	a = set()
	ap = a.add
	for s in map(frozenset, input().split()):
		ap(s)
	print(len(a))
solve()


import sys
data = sys.stdin.readlines()
lis = []
for line in data:
	lis.append(line)
words = set(list(map(frozenset, lis[1].split())))
print(len(words))


n = int(input())
ar = input().split()
z = set()
for x in ar:
	x = list(x)
	x.sort()
	x = ''.join(list(set(''.join(x))))
	z.add(x)
print(len(z))


def RAC(a):
	if a == '':
		return a
	b = ''
	for i in a:
		if b == '':
			b += i
		if b.find(i) != -1:
			pass
		else:
			b = b + i
	return b
n = int(input())
s = str(input()).split()
ls = []
ans = 0
for i in range(0, n):
	tmp = RAC(s[i])
	l = len(tmp)
	ts = []
	for i in range(0, l):
		ts.append(tmp[i])
	ts.sort()
	tmp = ''
	tmp = tmp.join(ts)
	if ls.count(tmp) == 0:
		ls.append(tmp)
		ans += 1
print(ans)


input()
a = input().split()
b = set()
for x in a:
	b.add(''.join(sorted(set(x))))
print(len(b))


n = input()
op = []
po = list(map(str, input().split()))
for item in po:
	tam = list(set(item))
	tam.sort()
	op.append(''.join(tam))
print(len(set(op)))


n = int(input())
s = input().split()
li1 = list(s)
li2 = []
li3 = []
for i in li1:
	li4 = list(set(i))
	li4.sort()
	poo = ''.join((m for m in li4))
	li2.insert(-1, poo)
fin = set(li2)
print(len(fin))


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


n = int(input())
s = input().split()
l1 = []
for i in range(n):
	a = set(s[i])
	if a not in l1:
		l1.append(set(s[i]))
print(len(l1))


n = int(input())
myList = list(map(str, input().split()))
myList1 = []
for i in range(0, n):
	myWord = myList[i]
	myNewList = []
	for j in range(0, len(myWord)):
		if myWord[j] in myNewList:
			j = j
		else:
			myNewList.append(myWord[j])
	myNewWord = ''
	myNewList.sort()
	for k in range(0, len(myNewList)):
		myNewWord += myNewList[k]
	myList1.append(myNewWord)
myList2 = []
for x in range(0, len(myList1)):
	if myList1[x] in myList2:
		x = x
	else:
		myList2.append(myList1[x])
print(len(myList2))


n = int(input())
li = input().split(' ')
s = []
for x in li:
	a = ''.join(sorted(set(x), key=str))
	s.append(a)
print(len(set(s)))


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


def clean(word):
	a = set([])
	for char in word:
		a.add(char)
	a = sorted(a)
	return ','.join(list(a))
n = int(input())
words = map(str, input().split())
dic = {}
count = 0
for word in words:
	if clean(word) in dic:
		continue
	count = count + 1
	dic[clean(word)] = 1
print(count)


n = int(input().strip())
arr_s = list(map(str, input().split()))
res = 0
checked = []
for s in arr_s:
	temp = ''
	words = [0] * 26
	for ch in s:
		if temp.find(ch) == -1:
			temp += ch
			words[ord(ch) - 97] += 1
	if len(checked) == 0:
		checked.append(words)
		res += 1
	else:
		try:
			checked.index(words)
		except ValueError:
			checked.append(words)
			res += 1
print(res)


n = int(input())
l = []
m = [x for x in input().split()]
for x in m:
	s = list(set(list(x)))
	s.sort()
	if s not in l:
		l.append(s)
print(len(l))


def checkList(arr, word):
	for i in arr:
		if i == word:
			return True
	return False

def getRoot(word):
	newWord = ''
	for i in word:
		if not checkList(newWord, i):
			newWord += i
		if len(newWord) == 26:
			return 'abcdefghijklmnopqrstuvwxyz'
	return sorted(newWord)
num = int(input())
array = input().split(' ')
roots = []
for i in range(26):
	roots.append([])
for i in array:
	currRoot = getRoot(i)
	found = False
	currArr = roots[len(currRoot) - 1]
	for j in currArr:
		if j == currRoot:
			found = True
	if not found:
		roots[len(currRoot) - 1].append(currRoot)
length = 0
for i in roots:
	length += len(i)
print(length)


e = int(input())
l1 = input().split()
final = []
for i in l1:
	string = ''
	summer = 0
	for x in i:
		if x not in string:
			string += x
			temp = list(string)
			temp.sort()
			string = ''.join(temp)
	if string not in final:
		final.append(string)
print(len(final))


x = int(input())
a = list(input().split())
l = 0
b = ['']
for i in range(x):
	y = set(a[i])
	if y not in b:
		b.append(y)
		l += 1
print(l)


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


input()
print(len({''.join(sorted(set(word))) for word in input().split()}))


n = int(input())
l = input().split()
roots = {}
res = 0
for i in l:
	if ''.join(sorted(set(i))) not in roots:
		res += 1
		roots[''.join(sorted(set(i)))] = 1
print(res)


n = int(input())
words = input().split()
setx = set([])
for i in range(len(words)):
	k = sorted(words[i])
	l = set(k)
	words[i] = ''.join(l)
	setx.add(words[i])
print(len(setx))


n = int(input())
a = list(input().split())
temp = []
for item in a:
	if ''.join(sorted(set(item))) not in temp:
		temp.append(''.join(sorted(set(item))))
print(len(temp))


N = int(input())
words = input().split(' ')
firstNum = ord('a')
lastNum = ord('z')
alfLen = lastNum - firstNum + 1
roots = set()
for w in words:
	root = [0] * alfLen
	for l in w:
		root[ord(l) - firstNum] = 1
	newRoot = ''
	for (i, flag) in enumerate(root):
		if flag:
			newRoot += chr(i + firstNum)
	roots.add(newRoot)
print(len(roots))


n = int(input())
script = [str(x) for x in input().split()]
roots = list()
for i in range(n):
	word_root = set(script[i])
	if word_root not in roots:
		roots.append(word_root)
print(len(roots))


n = int(input())
p = [y for y in input().split()]
b = []
for j in p:
	u = sorted(set(j))
	y = ''.join(u)
	b.append(y)
print(len(set(b)))


n = int(input())
st = set()
for s in input().split():
	c = [0] * 26
	for i in s:
		c[ord(i) - ord('a')] = 1
	st.add(tuple(c))
print(len(st))


n = int(input())
ss = set()
l = input().split()
for s in l:
	ss.add(''.join(sorted(str(set(s)))))
print(len(ss))


n = int(input())
line = input()
words = line.split(' ')
ans = []
for word in words:
	ans.append(''.join(sorted(set(word))))
print(len(set(ans)))


n = input()
words = input().split()
sotre = []
for i in range(int(n)):
	if set(words[i]) not in sotre:
		sotre.append(set(words[i]))
print(len(sotre))


n = int(input())
a = input().split()
s1 = []
s2 = []
count = 0
for i in range(n):
	for j in range(len(a[i])):
		if a[i][j] not in s1:
			s1.append(a[i][j])
	k = sorted(s1)
	if k not in s2:
		count += 1
	s2.append(k)
	s1 = []
	k = []
print(count)


n = int(input())
mas = map(set, input().split())
gas = []
q = 0
pr = set('zyxwvutsrqponmlkjihgfedcba')
for el in mas:
	if not el & pr in gas:
		q += 1
		gas.append(el & pr)
print(q)


n = int(input())
strings = input().split(' ')
final_strings = []
for i in strings:
	i = list(i)
	i = set(i)
	i = list(i)
	i.sort()
	arr_str = ''
	for j in i:
		arr_str += j
	final_strings.append(arr_str)
print(len(set(final_strings)))


n = int(input())
aramic = list(input().split())
lists = []
for string in aramic:
	lists.append(sorted(set(list(string))))
ans = n
for i in range(1, n):
	for j in range(0, i):
		if lists[i] == lists[j]:
			ans -= 1
			break
print(ans)


n = int(input())
words = input().split(' ')
roots = set()
for word in words:
	roots.add(''.join(sorted(set(word))))
print(len(roots))


n = int(input())
s = set([tuple(sorted(set(i))) for i in input().split()])
print(len(s))


N = int(input())
src = input().split()

def tostr(st):
	ret = ''
	for c in sorted(st):
		ret += c
	return ret
ss = set()
for s in src:
	tmp = set(s)
	ss.add(tostr(tmp))
print(len(ss))


import string
n = int(input())
words = input().strip().split(' ')
count = set()
for i in range(n):
	m = ['0'] * 26
	for j in words[i]:
		ind = string.ascii_lowercase.index(j)
		m[ind] = '1'
	count.add(''.join(m))
print(len(count))


import sys
import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list or type(n) is str:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

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

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

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def revn(n):
	return int(str(n)[::-1])

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base=3):
	newnumber = ''
	while number > 0:
		newnumber = str(number % base) + newnumber
		number //= base
	return newnumber
n = ii()
s = list(input().split())
ans = [set(s[0])]
for i in range(1, n):
	si = set(s[i])
	f = True
	for item in ans:
		if item == si:
			f = False
			break
	if f:
		ans.append(si)
print(len(ans))


n = int(input())
s = input()
a = s.split(' ')
visited = []
for i in range(len(a)):
	visited.append(0)
arr = []
for g in range(len(a)):
	aux = []
	for h in range(26):
		aux.append(0)
	arr.append(aux)
for x in range(len(a)):
	for y in range(len(a[x])):
		if arr[x][ord(a[x][y]) - 97] == 0:
			arr[x][ord(a[x][y]) - 97] += 1
count_arr = []
for c in range(len(a)):
	count = 1
	for d in range(c + 1, len(a)):
		no = 1
		if visited[c] == 0:
			for e in range(26):
				if arr[c][e] != arr[d][e]:
					no = 0
					break
			if no == 1:
				count += 1
				visited[d] = 1
	if visited[c] == 0:
		count_arr.append(count)
	visited[c] = 1
print(len(count_arr))


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


n = int(input())
d1 = []
ans = 0
p = input().split()
for i in p:
	s = set(i)
	if d1.count(s) == 0:
		d1.append(s)
		ans += 1
print(ans)


input()
s = frozenset(map(frozenset, input().split()))
print(len(s))


n = int(input())
script = input().split()
l = set()
for i in script:
	k = list(''.join(set(i)))
	k.sort()
	k = str(k)
	l.add(k)
print(len(l))


n = int(input())
b = []
s = input().split(' ')
for i in s:
	a = [0] * 26
	for j in i:
		y = ord(j) - ord('a')
		a[y] = 1
	if a not in b:
		b.append(a)
print(len(b))


input()
words = list(input().split())
distinct = set()
for word in words:
	letters = set()
	for letter in word:
		letters.add(letter)
	distinct.add(frozenset(letters))
print(len(distinct))


n = int(input())
words = input().split(' ')
roots = {}
for word in words:
	root_elems = {}
	for c in word:
		if not c in root_elems:
			root_elems[c] = True
	root_elems_list = sorted(list(root_elems.keys()))
	root_elems_str = ''.join(root_elems_list)
	if not root_elems_str in roots:
		roots[root_elems_str] = True
print(len(roots))


n = int(input())
arr = input().split()
ans = 0
visited = {}
for i in range(n):
	s = set()
	for c in arr[i]:
		s.add(c)
	s = str(sorted(s))
	if s not in visited:
		ans += 1
	visited[s] = 1
print(ans)


n = int(input())
script = input().split()
l = []
for i in script:
	k = list(''.join(set(i)))
	k.sort()
	k = str(k)
	if k not in l:
		l.append(k)
print(len(l))


input()
a = []
for s in input().split():
	a.append(''.join(sorted(list(set(s)))))
print(len(set(a)))


n = int(input())
a = list(input().split())
q = []
for i in a:
	w = sorted(list(set(list(i))))
	if w not in q:
		q.append(w)
print(len(q))


n = int(input())
s = set()
for i in input().split(' '):
	t = list(set(i))
	t.sort()
	s.add(''.join(t))
print(len(s))


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 = input().split()
sets = []
c = 0
for i in a:
	s = set(i)
	bl = True
	for j in sets:
		if j == s:
			bl = False
			break
	if bl:
		sets.append(s)
		c += 1
print(c)


n = int(input())
s = input()
print(len(set([''.join(sorted(list(set(x)))) for x in s.split()])))


n = int(input())
words = input().strip().split()

def root(word):
	letters = []
	for l in word:
		if l not in letters:
			letters.append(l)
	return ''.join(sorted(letters))
roots = []
for word in words:
	r = root(word)
	if r not in roots:
		roots.append(r)
print(len(roots))


n = int(input())
s = input().split()
dict = set()
for str in s:
	kor = set()
	for c in str:
		kor.add(c)
	kors = []
	for c in kor:
		kors.append(c)
	kors = sorted(kors)
	sk = ''
	for c in kors:
		sk = sk + c
	dict.add(sk)
print(len(dict))


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


from collections import OrderedDict
n = int(input())
s = list(input().split())
for i in range(n):
	s[i] = ''.join(OrderedDict.fromkeys(s[i]))
	s[i] = ''.join(sorted(s[i]))
t = set(s)
print(len(t))


from itertools import groupby
n = int(input())
lst = input().split()
lst2 = []
for i in range(n):
	lst1 = list(lst[i])
	lst1.sort()
	lst1 = [el for (el, _) in groupby(lst1)]
	if lst1 not in lst2:
		lst2.append(lst1)
print(len(lst2))


n = int(input())
l = list()
st = 'abcdefghijklmnopqrstuvwxyz'
ll = input().split()
b = 0
for i in ll:
	lll = list()
	for k in st:
		if i.find(k) == -1:
			lll.append(0)
		else:
			lll.append(1)
	if lll not in l:
		l.append(lll)
print(len(l))


n = int(input())
a = []
s = input().split()
for i in s:
	s1 = []
	for j in i:
		if j not in s1:
			s1.append(j)
	s1.sort()
	str1 = ''.join(s1)
	if str1 not in a:
		a.append(str1)
print(len(a))


def dedup(word):
	prev = ''
	res = ''
	for x in word:
		if x == prev:
			continue
		prev = x
		res = res + x
	return res
n = input()
res = set([])
for word in input().split():
	sorted_word = ''.join(sorted(word))
	res.add(dedup(sorted_word))
print(len(res))


a = input()
print(len(set([''.join(set(''.join(sorted(i)))) for i in input().split()])))


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))


n = int(input())
L = input().split(' ')

def equal(s1, s2):
	L = []
	S = []
	for char in s1:
		L.append(char)
	for char in s2:
		S.append(char)
	L = set(L)
	S = set(S)
	if L == S:
		return True
	else:
		return False
count = 0
M = []
N = []

def washla(string):
	L = []
	for char in string:
		L.append(char)
	L = set(L)
	return L
for char in L:
	M.append(washla(char))
for char in M:
	if char in N:
		continue
	else:
		N.append(char)
print(len(N))


n = int(input())
words = input().split()
s = set()
for word in words:
	s.add(''.join(sorted(list(set(list(word))))))
print(len(s))


n = int(input())
ln = input().split(' ')
rts = {}
for i in range(0, len(ln)):
	st = ln[i]
	nc = {}
	nt = ''
	for j in range(0, len(st)):
		if st[j] not in nc:
			nc[st[j]] = True
			nt += st[j]
	nt = ''.join(sorted(list(nt)))
	if nt not in rts:
		rts[nt] = True
print(len(rts))


n = int(input())
a = []
army = 0
words = input().split()
for i in range(n):
	s = set(words[i])
	if s not in a:
		army += 1
		a.append(s)
print(army)


n = input()
n = int(n)
line = input()
words = line.split()
l = list()
for word in words:
	tmp_set = set(word)
	if tmp_set not in l:
		l.append(tmp_set)
print(len(l))


n = int(input())
si = input().split()
alth = 'qwertyuiopasdfghjklzxcvbnm'
alth2 = [[0] * 26 for i in range(n)]
alth3 = [0] * n
i = 0
while i < n:
	for letter in si[i]:
		alth2[i][alth.find(letter)] = 1
	i += 1
i = 0
while i < n:
	j = 0
	while j < 26:
		alth3[i] += alth2[i][j] * 2 ** j
		j += 1
	i += 1
alth3.sort()
i = 1
ans = 1
while i < n:
	if alth3[i - 1] != alth3[i]:
		ans += 1
	i += 1
print(ans)


import atexit
import io
import sys
_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))
main()


n = int(input())
barer = [i for i in input().split()]
x = set()
for w in barer:
	w = list(set(list(w)))
	w.sort()
	w = ''.join(w)
	x.add(w)
print(len(x))


input()
words = frozenset(map(frozenset, input().split()))
print(len(words))


n = int(input())
line = input().split(' ')
unique = {''}
for e in line:
	temp = list(set(e))
	temp.sort()
	unique.add(''.join(temp))
print(len(unique) - 1)


input()
arr = input().split()
roots = []
for x in arr:
	root = ''.join(sorted(set(x)))
	if root not in roots:
		roots.append(root)
print(len(roots))


n = int(input())
a = [list(set(x)) for x in input().split()]
for i in a:
	i = i.sort()
dic = {}
for i in a:
	s = ''.join(i)
	if s not in dic:
		dic[s] = 1
sum = 0
for x in dic:
	sum += 1
print(sum)


n = input()
lst = input().split(' ')
coll = set()
for s in lst:
	coll.add(''.join(sorted(set(s))))
print(len(coll))


t = int(input())
l1 = [set(x) for x in input().split()]
i = 0
table = []
for x in l1:
	if x not in table:
		table.append(x)
print(len(table))


l = int(input())
line = input().split()
res = set()
for word in line:
	setsito = set()
	for c in word:
		setsito.add(c)
	res.add(str(sorted(setsito)))
print(len(res))


n = int(input())
s = input().split()
d = []
count = 0
for a in s:
	t = set(a)
	if t not in d:
		d.append(t)
		count += 1
print(count)


n = int(input())
arr = list(input().split())
st = set()
for w in arr:
	s = set()
	for c in w:
		s.add(c)
	st.add(frozenset(s))
print(len(st))


from collections import defaultdict
d = defaultdict(list)
n = int(input())
a = input().split()
for i in range(n):
	l = list(sorted(set(a[i])))
	s = ''.join(l)
	if s in d:
		continue
	else:
		d[s] = 1
print(len(d))


def get_res(L):
	S = set()
	for word in L:
		x = sorted(list(set([ch for ch in word])))
		s = ''.join(x)
		if s not in S:
			S.add(s)
	return len(S)
N = int(input())
L = [s for s in input().split(' ')]
result = get_res(L)
print('{}'.format(result))


n = int(input())
arr = list(map(str, input().split()))
ans = []
for x in arr:
	x = list(set(x))
	x = sorted(x)
	if x not in ans:
		ans.append(x)
print(len(ans))


def f():
	n = int(input())
	b = []
	x = input().split()
	for i in range(n):
		a = x[i]
		a = list(set([i for i in a]))
		b.append(frozenset(a))
	b = list(set(b))
	print(b.__len__())
f()


n = int(input())
s = list(input().split())
roots = []
for i in range(0, n):
	root = []
	for j in range(0, len(s[i])):
		if s[i][j] not in root:
			root.append(s[i][j])
	''.join(root)
	root = sorted(root)
	if root not in roots:
		roots.append(root)
print(len(roots))


n = int(input())
words = input().split()
roots = map(lambda word: ''.join(sorted(set(word))), words)
print(len(set(roots)))


n = int(input())
l = list(map(set, input().split()))
l1 = []
l1.append(l[0])
for i in range(1, n):
	if l[i] in l1:
		pass
	else:
		l1.append(l[i])
print(len(l1))


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


num = int(input())
str_list = input().split(' ')

def get_root(s):
	ss = set(s)
	ss = list(ss)
	ss.sort()
	return str(ss)
print(len(set([get_root(x) for x in str_list])))


n = int(input())
alist = list(map(str, input().split()))
clist = []
for i in alist:
	blist = []
	for j in range(len(i)):
		blist.append(i[j])
	clist.append(blist)
for i in range(len(clist)):
	a = set(clist[i])
	clist[i] = a
count = 0
for i in range(len(clist)):
	if clist[i] in clist[0:i]:
		continue
	else:
		count = count + 1
print(count)


n = int(input())
s = input().split()
dic = {}
count = 0
for i in range(0, n):
	dic[i] = []
	count += 1
	flag = 0
	for j in s[i]:
		if j in dic[i]:
			flag = 1
		else:
			dic[i] += [j]
	dic[i].sort()
list = []
for i in dic:
	if dic[i] in list:
		count = count - 1
	else:
		list += [dic[i]]
print(count)


t = str(input())
arr = [str(x) for x in input().split()]
ss = set()
for x in arr:
	a2 = []
	s = ''
	for i in range(int(26)):
		a2.append(0)
	for i in range(len(x)):
		nu = ord(x[i])
		nu = nu - ord('a')
		a2[nu] = 1
	for i in range(int(26)):
		if a2[i] == 1:
			s = s + str(chr(i + ord('a')))
	ss.add(s)
print(len(ss))


def root(word):
	r = ''
	for c in 'abcdefghijklmnopqrstuvwxyz':
		if word.count(c) > 0:
			r += c
	return r
n = int(input())
s = list(map(root, input().split()))
print(len(set(s)))


input()
words = input().strip().split()
s = set()
for word in words:
	s.add(''.join(sorted(set(word))))
print(len(s))


n = int(input())
l = list(map(str, input().split()))
l = [frozenset(i) for i in l]
s = set()
for i in l:
	s.add(i)
print(len(s))


input()

def f(s):
	return ''.join(sorted(set(s)))
arr = set(map(f, input().split()))
print(len(arr))


f = lambda s: ''.join(sorted(set(s)))
input()
print(len(set(map(f, input().split()))))


R = lambda : map(int, input().split())
(n,) = R()
a = input().split()
ans = set()
for i in a:
	i = ''.join(list(sorted(set(i))))
	if i not in ans:
		ans.add(i)
print(len(ans))


N = int(input())
script = list(input().split())
roots = set()
for s in script:
	roots.add(''.join(sorted(set(s))))
print(len(roots))


n = int(input())
arr = map(str, input().strip().split())
d = {}
for ele in arr:
	s = set(ele)
	k = ''
	for item in s:
		k += item
	k = ''.join(sorted(k))
	if k in d:
		d[k] += 1
	else:
		d[k] = 1
print(len(d))


n = int(input())
z = str(input()).split()
clean = [''.join(sorted(set(x))) for x in z]
unicos = set(clean)
cuenta = len(unicos)
print(cuenta)


(n, s) = (int(input()), list(input().split()))
(a, ans) = ([], [])
for i in range(n):
	b = set(sorted([x for x in s[i]]))
	a.append(b)
for i in a:
	if i not in ans:
		ans.append(i)
print(len(ans))


def counting(word):
	chars = []
	for char in word:
		if char not in chars:
			chars.append(char)
	chars.sort()
	return ''.join(chars)
n = [int(x) for x in input().rstrip().split()][0]
words = [x for x in input().rstrip().split()]
num_char = []
for word in words:
	num_word = counting(word)
	if num_word not in num_char:
		num_char.append(num_word)
print(len(num_char))


def ctoi(char):
	return ord(char) - 97
N = int(input())
S = list(map(str, input().split(' ')))
arr = set()
for i in range(N):
	ls = [0] * 26
	for char in S[i]:
		if ls[ctoi(char)] == 0:
			ls[ctoi(char)] = 1
	arr.add(tuple(ls))
print(len(arr))


n = int(input())
l = [i for i in input().split()]
y = []
for i in l:
	x = [k for k in i]
	x = list(set(x))
	x.sort()
	ans = ''
	for j in x:
		ans += j
	y.append(ans)
y = list(set(y))
y.sort()
print(len(y))


n = int(input())
inp = input().split()
alles = []
for i in range(n):
	sth = []
	a = sorted(inp[i])
	for j in range(len(a)):
		if j + 1 == len(a) or a[j + 1] != a[j]:
			sth.append(a[j])
	alles.append(sth)
alles = sorted(alles)
k = 0
for i in range(len(alles)):
	if i + 1 == n or alles[i + 1] != alles[i]:
		k = k + 1
print(k)


a = int(input())
b = list(input().split())
list1 = []
for wrd in b:
	temp = set()
	for ch in wrd:
		temp.add(ch)
	flag = 0
	for i in list1:
		if i == temp:
			flag = 1
			break
	if flag == 0:
		list1.append(temp)
print(len(list1))


n = input()
array = list()
array = input().split()
index = [0] * 26
count = 0
arr = list()
for i in range(len(array)):
	word = array[i]
	str = ''
	for j in range(len(word)):
		index[ord(word[j]) - 97] += 1
	for j in range(26):
		if index[j] != 0:
			str = str + chr(j + 97)
	index = [0] * 26
	if str not in arr:
		arr.append(str)
		count += 1
print(count)


n = int(input())
a = []
ap = a.append
k = 0
b = list(map(set, input().split()))
for s in b:
	if not s in a:
		k += 1
	ap(s)
print(k)


n = int(input())
s = input().split()
cl = []
count = 0
for x in s:
	if set(x) not in cl:
		cl.append(set(x))
		count += 1
print(count)


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())
lst = []
lst1 = []
n1 = list(map(str, input().split()))
for i in n1:
	s = set(i)
	lst.append(s)
for j in lst:
	if j in lst1:
		continue
	lst1.append(j)
print(len(lst1))


n = int(input())
s = set()
l = list(input().split())
for j in l:
	s.add(''.join(sorted(list(set(j)))))
print(len(list(s)))


n = int(input())
words = [str(x) for x in input().split()]
for i in range(n):
	letters = list(words[i])
	a = []
	root = ''
	for letter in letters:
		if letter in a:
			pass
		else:
			a.append(letter)
	a.sort()
	for x in a:
		root += x
	words[i] = root
final_list = []
for word in words:
	if word in final_list:
		pass
	else:
		final_list.append(word)
print(len(final_list))


def get_root(word):
	root = tuple(sorted(list(set(list(word)))))
	return root
n = int(input())
root_set = set()
words = input().split()
for word in words:
	root = get_root(word)
	root_set.add(root)
print(len(root_set))


n = int(input())
l = list(map(str, input().split()))
l1 = []
for i in l:
	lp = list(set(i))
	lp.sort()
	sp = str(lp)
	l1.append(sp)
s = set(l1)
print(len(s))


n = int(input())
arr = list(input().strip().split())
s = set()
for i in range(len(arr)):
	arr1 = list(set(arr[i]))
	arr1.sort()
	s.add(''.join(arr1))
print(len(s))


def get_obj_count(words):
	roots_list = [frozenset(word) for word in words]
	roots_set = set(roots_list)
	return len(roots_set)
n = int(input())
words = [word for word in input().split()]
print(get_obj_count(words))


n = int(input())
data = list(map(str, input().split()))
d = {}

def con(inp):
	return frozenset(list(inp))
for el in data:
	p = con(el)
	if d.get(p) is None:
		d[p] = 1
print(len(d.keys()))


def solve():
	n = int(input())
	a = set()
	ap = a.add
	for s in input().split():
		ap(''.join(sorted(list(set(s)))))
	print(len(a))
solve()


n = int(input())
l = list(input().split())
l1 = []
for i in l:
	i = set(i)
	i = list(i)
	i.sort()
	l1.append(i)
l1.sort()
c = 0
for i in range(len(l1) - 1):
	if l1[i] != l1[i + 1]:
		c += 1
print(c + 1)


n = int(input())
a = list(input().split())
b = []
al = 'abcdefghijklmnopqrstuvwxyz'
for i in a:
	c = [0] * 26
	for j in i:
		c[97 - ord(j)] = 1
	r = ''
	for j in range(26):
		if c[j] == 1:
			r += al[j]
	b.append(r)
print(len(set(b)))


n = int(input())
w = input().split()
w2 = []
for i in range(len(w)):
	w[i] = set(w[i])
i = 0
j = 0
for item in w:
	w2.append(''.join(sorted(list(item))))
print(len(set(w2)))


n = int(input())
s = list(input().split())
dic = dict()
for i in s:
	l2 = list(set(list(i)))
	l2.sort()
	l2 = ''.join(l2)
	if l2 in dic:
		pass
	else:
		dic[l2] = 1
c = 0
for i in dic:
	c += 1
print(c)


from bisect import bisect_left, bisect_right

def _input():
	return map(int, input().strip().split())

def _print(s):
	print(''.join(map(str, s)))

def squeeze(s):
	t = set()
	for e in s:
		t.add(e)
	t = sorted(t)
	return ''.join(list(t))
n = int(input())
s = list(input().strip().split())
r = set()
for sx in s:
	r.add(squeeze(sx))
print(len(r))


n = int(input())
ars = set()
ws = input().split()
for w in ws:
	ars.add(tuple(sorted(set([l for l in w]))))
print(len(ars))


n = int(input())
s = input().split()
unique = set()
for word in s:
	v = int(0)
	for letter in word:
		v = v | int(1 << ord(letter) - 65)
	unique.add(v)
print(len(unique))


a = int(input())
s = set()
l = list(input().split())
for i in l:
	s.add(''.join(sorted(list(set(i)))))
print(len(list(s)))


n = int(input())
s = input().split()
ans = set()
for i in s:
	se = set()
	for j in i:
		se.add(j)
	se = list(se)
	se.sort()
	ans.add(tuple(se))
print(ans.__len__())


n = int(input())
scripts = input().split(' ', n)
characterMap = {}
for i in range(26):
	characterMap[chr(ord('a') + i)] = i
alphabetMap = []
for i in range(n):
	column = []
	for j in range(26):
		column.append(False)
	alphabetMap.append(column)
for i in range(len(scripts)):
	for j in range(len(scripts[i])):
		alphabetMap[i][characterMap.get(scripts[i][j])] = True
codedList = [0 for i in range(n)]
for i in range(int(n)):
	for j in range(26):
		if alphabetMap[i][j]:
			codedList[i] += pow(2, 25 - j)
codedList.sort()
codedList = list(set(codedList))
print(len(codedList))


from sys import stdin, stdout
n = int(stdin.readline())
arr = [''.join(sorted(set(x))) for x in stdin.readline().split()]
stdout.write(str(len(set(arr))))


import os
import sys

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7

def ssinp():
	return input()

def iinp():
	return int(input())

def nninp():
	return map(int, input().split())

def llinp():
	return list(map(int, input().split()))

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math
from collections import OrderedDict
n = int(input())
l = list(map(str, input().split()))
s = set()
ans = 0
for c in l:
	s1 = set(c)
	l1 = [str(char) for char in s1]
	l1.sort()
	a = lts(l1)
	if a not in s:
		ans += 1
		s.add(a)
print(ans)


def main():
	input()
	print(len(set((''.join(sorted(set(w))) for w in input().split()))))
main()


def return_root(s):
	used_c = set()
	res = list()
	for c in s:
		if not c in used_c:
			used_c.add(c)
			res += c
	res.sort()
	res = str(res)
	return res
N = int(input())
strs = input().split()
used_str = set()
ans = int()
for s in strs:
	root_s = return_root(s)
	if not root_s in used_str:
		used_str.add(root_s)
		ans += 1
print(ans)


input()
print(len(set(map(tuple, map(sorted, map(set, input().split()))))))


n = int(input())
words = input().split(' ')
different = []
for word in words:
	s = set(word)
	if s not in different:
		different.append(s)
print(len(different))


input()
print(len(set((''.join(sorted(set(x))) for x in input().split()))))


n = int(input())
s = [x for x in input().split()]
a = []
for i in s:
	u = sorted(set(i))
	x = ''.join(u)
	a.append(x)
print(len(set(a)))


def solve():
	n = int(input())
	a = []
	ap = a.append
	for s in map(set, input().split()):
		if not s in a:
			ap(s)
	print(len(a))
solve()


n = int(input())
a = input().split()
b = []
for k in range(len(a)):
	c = []
	for p in a[k]:
		c.append(p)
	c = list(set(c))
	c.sort()
	c = ''.join(c)
	if c not in b:
		b.append(c)
print(len(b))


import os
import sys
import math

def main():
	n = int(input())
	a = [str(i) for i in input().split()]
	b = []
	for i in a:
		if set(i) not in b:
			b.append(set(i))
	print(len(b))
main()


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(' ')
a = ''
temp = set()
ans = set()
for a in s:
	for b in a:
		temp.add(b)
	ans.add(''.join([e for e in sorted(temp)]))
	temp.clear()
print(len(ans))


n = int(input())
a = list(input().split())
o = [[0] * 26 for u in range(n)]
for i in range(n):
	for u in range(len(a[i])):
		o[i][ord(a[i][u]) - 97] = 1
o.sort()
kol = n
for t in range(1, n):
	if o[n - t] == o[n - t - 1]:
		kol -= 1
print(kol)


import sys
n = sys.stdin.readline()
words = sys.stdin.readline().split()
known = set()

def to_root(s):
	return ''.join(sorted(set([c for c in s])))
for word in words:
	known.add(to_root(word))
print(len(known))


def a():
	t = int(input())
	d = set()
	count = 0
	s = input().split(' ')
	for x in s:
		h = {}
		m = 0
		for l in x:
			h[l] = True
		f = ''.join(sorted(list(h.keys())))
		d.add(f)
	print(len(d))
a()


n = int(input())
a = input().split()
myset = set()
for x in a:
	n = 0
	for c in x:
		n |= 1 << ord(c) - ord('a')
	myset.add(n)
print(len(myset))


def main():
	sentence = input().split(' ')
	words = []
	for i in sentence:
		word = ''
		array = []
		for n in range(len(i)):
			if i[n] not in array:
				array.append(i[n])
		array.sort()
		for j in array:
			word += j
		if word not in words:
			words.append(word)
	print(len(words))
n = int(input())
main()


n = int(input())
arr = list(map(str, input().split()))
store = []
cnt = 0
for i in arr:
	if set(i) not in store:
		cnt += 1
		store.append(set(i))
print(cnt)


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


n = eval(input())
l = input()
ls = l.split(' ')
an = []
ans = 0
for i in ls:
	st = set(i)
	if st not in an:
		an.append(st)
		ans += 1
print(ans)


input()
a = list(input().split())
d = {}
for s in a:
	b = sorted(set(s))
	d[str(b)] = 1
print(len(d))


n = int(input())
m = input().split()
k = 'abcdefghijklmnopqrstuvwxyz'
l = []
for t in m:
	a = ''
	for s in k:
		if s in t:
			a = a + s
	l.append(a)
print(len(set(l)))


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


n = int(input())
string = list(map(str, input().split()))
root = []
for i in string:
	temp = set()
	for j in i:
		if j in temp:
			continue
		else:
			temp.add(j)
	if temp in root:
		continue
	else:
		root.append(temp)
print(len(root))


n = int(input())
l = list(map(str, input().split()))
s = []
a = 0
for i in range(len(l)):
	f = set(l[i])
	if f not in s:
		a += 1
		s.append(f)
print(a)


int(input())
s = set()
for i in input().split():
	s.add(frozenset(i))
print(len(s))


def root(st):
	li = [False] * 40
	for c in st:
		li[ord(c) - ord('a')] = True
	ans = ''
	for i in range(len(li)):
		if li[i]:
			ans += chr(i + ord('a'))
	return ans

def main():
	n = int(input())
	li = [root(w) for w in input().split()]
	li.sort()
	count = 1
	for i in range(n - 1):
		if li[i] != li[i + 1]:
			count += 1
	print(count)
main()


n = int(input())
words = input().split()
distinct = []
for x in words:
	letters = []
	for y in x:
		if y not in letters:
			letters.append(y)
	letters = sorted(letters)
	if letters not in distinct:
		distinct.append(letters)
print(len(distinct))


n = int(input())
s = list(input().split())
ans = set()
for i in s:
	c = set()
	for j in i:
		c.add(j)
	d = ''
	for x in c:
		d += x
	ans.add(''.join(sorted(d)))
print(len(ans))


n = int(input())
a = map(str, input().split())
b = []
for s in a:
	b.append(set(s))
c = []
for s in b:
	if s not in c:
		c.append(s)
print(len(c))


Input = lambda : map(str, input().split())
n = int(input())
s = list(Input())
Tmp = dict()
for i in range(n):
	Tmp[''.join(sorted(set(s[i])))] = 1
print(len(Tmp))


n = int(input())
l = [x for x in input().split()]
l2 = []
for i in l:
	if not set(i) in l2:
		l2.append(set(i))
print(len(l2))


n = int(input())
l = input().split()
t = []
for i in l:
	x = set(i)
	y = list(x)
	y.sort()
	if y not in t:
		t.append(y)
print(len(t))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 15
mod = 10 ** 9 + 7

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = LS()
	s = set()
	for c in a:
		cc = tuple(sorted(collections.Counter(c).keys()))
		s.add(cc)
	return len(s)
print(main())


n = input()
s = input().split()
a = set()
for i in s:
	b = set()
	for j in i:
		b.add(j)
	a.add(''.join(sorted(list(b))))
print(len(a))


Answers = []
input()
X = list(input().split())
for i in X:
	myDict = {}
	for j in i:
		myDict[j] = 0
	if sorted(myDict.keys()) not in Answers:
		Answers.append(sorted(myDict.keys()))
print(len(Answers))


n = int(input())
res = set()
s = input().split()
for i in s:
	res.add(''.join(sorted(set(list(i)))))
print(len(res))


test = input()
s = input().split()
q = []
for each in s:
	p = set(list(each))
	if p not in q:
		q.append(p)
print(len(q))


n = input()
st = set()
for word in input().split():
	s = set()
	for char in word:
		s.add(char)
	st.add(frozenset(s))
print(len(st))


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))


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))


n = int(input())
print(len(set(map(lambda x: ''.join(sorted(set(x))), input().split()))))


n = int(input())
l = input().split()
ll = []
for i in range(n):
	ss = []
	for j in range(len(l[i])):
		if l[i][j] not in ss:
			ss.append(l[i][j])
	ss.sort()
	if ss not in ll:
		ll.append(ss)
print(len(ll))


def root(s):
	root = str()
	for k in s:
		if not k in root:
			root += k
	return ''.join(sorted(root))
l = list()
n = int(input())
m = map(str, input().split())
for i in m:
	if not root(i) in l:
		l.append(root(i))
print(len(l))


n = int(input())
l = list(map(str, input().split()))
for i in range(n):
	st = ''.join(sorted(set(l[i])))
	l[i] = st
l = set(l)
print(len(l))


def make_uniq(word):
	w = sorted(list(set(word)))
	return ''.join(w)
n = int(input())
words = input().split(' ')
s = []
for w in words:
	s.append(make_uniq(w))
print(len(set(s)))


(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, dgraphs, mod) = (lambda : sorted(zz()), {}, 10 ** 9 + 7)
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
z()
l = z().split(' ')
x = []
c = 0
for i in l:
	p = sorted(set(i))
	if len(p) == len(set(i)) and p not in x:
		c += 1
		x.append(p)
print(c)


N = int(input())
L = list(input().split(' '))
L1 = set(L[0])
L2 = [L1]
c = 1
for i in range(1, N):
	S = set(L[i])
	if S not in L2:
		L2.append(S)
		c = c + 1
print(c)


n = int(input())
arr = input()
arr = arr.split(' ')
gl = []
count = 0
for word in arr:
	A = set()
	for el in word:
		A.add(el)
	if A not in gl and len(A) > 0:
		gl.append(A)
		count += 1
print(count)


count = int(input())
words = input().split()
roots = []
for w in words:
	currRoot = set(list(w))
	add = True
	for r in roots:
		if currRoot == r:
			add = False
			break
	if add:
		roots.append(currRoot)
print(len(roots))


def test_1():
	import math
	n = list(map(int, input().split(' ')))
	s = input().strip().split()
	a = list(map(set, s))
	a = list(map(sorted, a))
	b = list(map(''.join, a))
	print(len(set(b)))
test_1()


n = int(input())
ans = []
arr = [x for x in input().split()]
for a in arr:
	curr = sorted(set(a))
	if curr not in ans:
		ans.append(curr)
print(len(ans))


input()
s = input().split()
d = []
r = 0
for x in s:
	t = set(x)
	if t not in d:
		d.append(t)
		r += 1
print(r)


n = int(input())
s = set(map(str, input().split()))
geek = []
for i in s:
	geek.append(set(i))
result = []
for i in geek:
	if i not in result:
		result.append(i)
print(len(result))


input()
res = set()
for a in input().strip().split():
	res.add(frozenset(a))
print(len(res))


import sys
input = sys.stdin.readline
N = int(input())
S = input().split()
unique = set()
for x in S:
	out = set()
	for char in x:
		out.add(char)
	unique.add(''.join(sorted(out)))
print(len(unique))


def count_objects(array):
	roots = {tuple(sorted(set(s))) for s in array}
	return len(roots)
n = int(input().strip())
s = input().strip().split()[:n]
print(count_objects(s))


n = int(input())
l = input().split()
d = []
for i in l:
	s = list(set(i))
	s.sort()
	if s not in d:
		d.append(s)
print(len(d))


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)))


l = []
n = int(input())
cnt = 0
m = input().split()
for i in m:
	if set(i) not in l:
		l.append(set(i))
		cnt += 1
print(cnt)


n = int(input())
l = []
r = input().split(' ')
for i in range(0, n):
	l.append(r[i])
l1 = []
for i in l:
	s = list(i)
	re = set(s)
	if re not in l1:
		l1.append(re)
print(len(l1))


d = set()
input()
for i in input().split():
	x = set()
	for j in i:
		x.add(j)
	d.add(''.join(sorted(x)))
print(len(d))


n = int(input())
ws = set((''.join(sorted(set(w))) for w in input().split()))
print(len(ws))


n = int(input())
lst = list(map(str, input().split()))
res = []
for (i, x) in enumerate(lst):
	a = set(x)
	k = 0
	for (j, y) in enumerate(res):
		if y == a:
			k = 1
			break
	if k == 0:
		res.append(a)
print(len(res))


n = int(input())
arr = list(input().split())
st = set()
for s in arr:
	l = set()
	for ch in s:
		l.add(ch)
	l = sorted(l)
	st.add(''.join(l))
print(len(st))


e = int(input())
print(len(set([''.join(sorted(list(set(x)))) for x in input().split()])))


n = int(input())
l = list(input().split())
li = [str(sorted(set(i))) for i in l]
print(len(set(li)))


def main():
	input()
	s = set()
	for w in input().split():
		l = [0] * 26
		for c in w:
			l[ord(c) - 97] = 1
		s.add(tuple(l))
	print(len(s))
main()


from sys import stdin, stdout
rl = stdin.readline
wr = stdout.write
roots = set()
n = rl().strip()
s = list(map(str, rl().strip().split()))
for i in s:
	roots.add(str(set(sorted([x for x in i]))))
wr(f'{len(roots)}')


n = int(input())
d = set()
for i in input().split():
	d.add(frozenset(i))
print(len(d))


n = int(input())
s = input()
x = s.split(' ')
a = []
for i in x:
	b = set()
	for j in i:
		if j not in b:
			b.add(j)
	if b not in a:
		a.append(b)
print(len(a))


n = int(input())
S = list(map(str, input().split()))
for i in range(n):
	S[i] = set(S[i])
	S[i] = list(S[i])
	S[i].sort()
	S[i] = str(S[i])
print(len(set(S)))


n = int(input())
a = list(map(list, input().split()))
b = []
for i in range(len(a)):
	a[i] = list(set(a[i]))
	a[i].sort()
	if not a[i] in b:
		b.append(a[i])
print(len(b))


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


from collections import Counter
n = int(input())
d = set()
for el in input().split(' '):
	d.add(''.join(sorted(Counter(el).keys())))
print(len(d))


n = int(input())
from itertools import combinations
l = list(map(str, input().split()))
li = []
for i in l:
	lt = list(set(i))
	lt.sort()
	if lt not in li:
		li.append(lt)
print(len(li))


n = int(input())
strarr = list(map(str, input().strip().split(' ')))
i = 0
count = 0
root = []
for s in strarr:
	flag = 0
	if i == 0:
		root.append(''.join(sorted(set(s))))
		count = count + 1
	else:
		x = ''.join(sorted(set(s)))
		for j in root:
			if str(x) == str(j):
				flag = 1
				break
		if flag == 0:
			root.append(x)
			count = count + 1
	i = i + 1
print(count)


n = int(input())
arr = input().split()
ans = set()
for st in range(n):
	c = [0 for i in range(26)]
	for i in arr[st]:
		c[ord(i) - ord('a')] = 1
	k = ''
	for j in range(26):
		if c[j] == 1:
			k += str(j)
	ans.add(k)
print(len(ans))


n = int(input())
a = [list(set(list(x))) for x in input().split()]
cnt = 0
for i in range(0, len(a)):
	si = set(a[i])
	flag = 0
	for j in range(0, i):
		if set(a[j]).intersection(si) == si and set(a[j]).intersection(si) == set(a[j]):
			flag = 1
			break
	if flag == 0:
		cnt += 1
print(cnt)


n = int(input())
a = list(input().split())
dic = []
count = 0
for val in a:
	s = list(set(sorted(val)))
	if s not in dic:
		dic.append(s)
		count += 1
print(count)


n = input()
l = input().split()
l = [set(a) for a in l]
ans = []
for i in l:
	if i not in ans:
		ans.append(i)
print(len(ans))


n = int(input())
a = set(input().split())
aa = set()
for i in a:
	temp = set()
	temp.clear()
	for j in i:
		temp.add(j)
	ans = ''.join(temp)
	ans = sorted(ans)
	aa.add(''.join(ans))
print(len(aa))


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))


def main():
	input()
	(d, x, s) = ({}, 1, set())
	for c in 'abcdefghijklmnopqrstuvwxyz':
		d[c] = x
		x *= 2
	for w in input().split():
		x = 0
		for c in w:
			x |= d[c]
		s.add(x)
	print(len(s))
main()


EPS = 1e-09

def main():
	n = int(input())
	a = [x for x in input().split()]
	word = set()
	for s in a:
		t = ''
		for c in range(ord('a'), ord('z') + 1):
			if s.count(chr(c)) != 0:
				t += chr(c)
		word.add(t)
	print(len(word))
main()


n = int(input())
print(len(set([''.join(sorted(e)) for e in list(map(set, input().split()))])))


n = int(input())
l = list(input().split())
l2 = []
for i in l:
	x = list(i)
	x.sort()
	x = list(set(x))
	x = ''.join(x)
	l2.append(x)
l2 = list(set(l2))
print(len(l2))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
n = get_int()
lst = get_string().split()
count = []
for i in range(n):
	s = set(lst[i])
	if s not in count:
		count.append(s)
print(len(count))


N = int(input())
lst = [k for k in input().split(' ')]
distinct = []
for l in lst:
	dist = []
	for i in l:
		if i not in dist:
			dist.append(i)
	b = sorted(dist)
	if ''.join(b) not in distinct:
		distinct.append(''.join(b))
print(len(distinct))


n = int(input())
words = list(input().split())
kornes = []
for i in range(n):
	word = [0] * 26
	for j in words[i]:
		word[ord(j) - 97] += 1
	for i in range(26):
		if word[i] > 1:
			word[i] = 1
	if word not in kornes:
		kornes.append(word)
print(len(kornes))


def solution(s):
	roots = set()
	for w in s:
		roots.add(tuple(sorted(set(w))))
	return len(roots)
n = int(input().strip())
s = input().strip().split()[:n]
print(solution(s))


n = int(input())
a = list(input().split(' '))
s = set()
for i in range(n):
	t = []
	for j in range(len(a[i])):
		if a[i][j] not in t:
			t.append(a[i][j])
	t = sorted(t)
	s.add(''.join(map(str, t)))
print(len(s))


def get_root(s):
	return ''.join(sorted(list(set(s))))
n = int(input())
d = {}
l = set(map(get_root, input().split()))
print(len(l))


n = int(input())
s = input().split()
ans = []
for i in s:
	tmp = []
	for j in i:
		if j not in tmp:
			tmp.append(j)
	tmp.sort()
	ss = ''.join(tmp)
	if ss not in ans:
		ans.append(ss)
print(ans.__len__())


no_of_strings = int(input())
strings = list(map(str, input().split()))
root = []
for each in strings:
	cur_str = set(list(each))
	if not cur_str in root:
		root.append(cur_str)
print(len(root))


def go():
	n = int(input())
	words = input().split(' ')
	import string
	if n == 1:
		print(1)
		return
	output = {}
	for word in words:
		current = ''
		for i in string.ascii_lowercase:
			if i in word:
				current += i
		output[current] = None
	print(len(output.keys()))
go()


n = int(input())
list1 = input().split()
final = []
for i in list1:
	string = ''
	summer = 0
	for x in i:
		if x not in string:
			string += x
			temp = list(string)
			temp.sort()
			string = ''.join(temp)
	if string not in final:
		final.append(string)
print(len(final))


def find_aramic(script):
	aramic = []
	if len(script) < 1:
		return aramic
	aramic.append(script[0])
	aramic_len = 1
	for i in range(1, len(script)):
		if aramic[aramic_len - 1] != script[i]:
			aramic.append(script[i])
			aramic_len += 1
	return aramic
n = int(input())
raw_script = list(input().split())
script_list = []
for i in range(n):
	script_list.append(list(raw_script[i]))
	script_list[i].sort()
	script_list[i] = find_aramic(script_list[i])
script_list.sort()
aramic_count = 1
last_aramic = 0
for i in range(1, n):
	if script_list[i] != script_list[last_aramic]:
		aramic_count += 1
		last_aramic = i
print(aramic_count)


N = int(input())
S = input().split(' ')
s = [tuple(sorted(tuple(set(i)))) for i in S]
print(len(set(s)))


n = int(input())
a = [str(x) for x in input().split()]
b = sorted(a)
b.sort()
d = []
for i in range(0, n):
	c = b[i]
	c = sorted(set(b[i]))
	d.append(c)
e = []
for i in d:
	if i not in e:
		e.append(i)
print(len(e))


n = int(input())
l = list(map(str, input().split()))
d = {}
for i in l:
	s = list(set(i))
	s.sort()
	s = ''.join(s)
	if s in d:
		d[s] += 1
	else:
		d[s] = 1
print(len(d))