There are some ambiguities when one writes Berland names with the letters of the Latin alphabet.

For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" denote the same name.

The second ambiguity is about the Berland sound h: one can use both "h" and "kh" to write it. For example, the words "mihail" and "mikhail" denote the same name.

There are n users registered on the Polycarp's website. Each of them indicated a name represented by the Latin letters. How many distinct names are there among them, if two ambiguities described above are taken into account?

Formally, we assume that two words denote the same name, if using the replacements "u" [Image] "oo" and "h" [Image] "kh", you can make the words equal. One can make replacements in both directions, in any of the two words an arbitrary number of times. A letter that resulted from the previous replacement can participate in the next replacements.

For example, the following pairs of words denote the same name:  "koouper" and "kuooper". Making the replacements described above, you can make both words to be equal: "koouper" $\rightarrow$ "kuuper" and "kuooper" $\rightarrow$ "kuuper".  "khun" and "kkkhoon". With the replacements described above you can make both words to be equal: "khun" $\rightarrow$ "khoon" and "kkkhoon" $\rightarrow$ "kkhoon" $\rightarrow$ "khoon". 

For a given list of words, find the minimal number of groups where the words in each group denote the same name.


-----Input-----

The first line contains integer number n (2 ≤ n ≤ 400) — number of the words in the list.

The following n lines contain words, one word per line. Each word consists of only lowercase Latin letters. The length of each word is between 1 and 20 letters inclusive.


-----Output-----

Print the minimal number of groups where the words in each group denote the same name.


-----Examples-----
Input
10
mihail
oolyana
kooooper
hoon
ulyana
koouper
mikhail
khun
kuooper
kkkhoon

Output
4

Input
9
hariton
hkariton
buoi
kkkhariton
boooi
bui
khariton
boui
boi

Output
5

Input
2
alex
alex

Output
1



-----Note-----

There are four groups of words in the first example. Words in each group denote same name:  "mihail", "mikhail"  "oolyana", "ulyana"  "kooooper", "koouper"  "hoon", "khun", "kkkhoon" 

There are five groups of words in the second example. Words in each group denote same name:  "hariton", "kkkhariton", "khariton"  "hkariton"  "buoi", "boooi", "boui"  "bui"  "boi" 

In the third example the words are equal, so they denote the same name.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
mapp = {}
for _ in range(int(input())):
	data = input()
	new = []
	data = data.replace('u', 'oo')
	i = len(data) - 1
	while i >= 0:
		new.append(data[i])
		if data[i] == 'h':
			i -= 1
			while data[i] == 'k':
				i -= 1
		else:
			i -= 1
	new = new[::-1]
	temp = ''.join(new)
	if temp in mapp:
		mapp[temp] += 1
	else:
		mapp[temp] = 1
print(len(mapp))


import re
n = int(input())
s = set()
r1 = re.compile('u')
r2 = re.compile('k+h')
for _ in range(n):
	tmp = input().strip()
	tmp = r1.sub('oo', tmp)
	tmp = r2.sub('h', tmp)
	s.add(tmp)
print(len(s))


itr = int(input())
l = []
for i in range(itr):
	m = input()
	l.append(m)
d = []
for i in l:
	while i.count('kh') > 0 or i.count('oo') > 0:
		i = i.replace('kh', 'h')
		i = i.replace('oo', 'u')
	d.append(i)
d = set(d)
l = []
for i in d:
	i = i.replace('h', 'kh')
	i = i.replace('u', 'oo')
	l.append(i)
print(len(set(l)))


n = int(input())
ans = set()
for i in range(n):
	s = str(input())
	s = s.replace('u', 'oo')
	while 'kh' in s:
		s = s.replace('kh', 'h')
	ans.add(s)
print(len(ans))


n = int(input())
words = [input() for i in range(n)]
ans = set()
for i in range(n):
	temp = words[i]
	while 'u' in temp:
		temp = temp.replace('u', 'oo')
	while 'kh' in temp:
		temp = temp.replace('kh', 'h')
	ans.add(temp)
print(len(ans))


n = int(input())
result = set()
for i in range(n):
	s = str(input())
	for it in range(20):
		s = s.replace('u', 'oo')
		s = s.replace('kh', 'h')
	s = [s]
	result.update(s)
print(len(result))


n = int(input())
words = [input() for _ in range(n)]
s = set()
for w in words:
	while 'kh' in w or 'u' in w:
		if 'kh' in w:
			for i in range(len(w) - 1):
				if 'kh' == w[i:i + 2]:
					w = w[:i] + 'h' + w[i + 2:]
		else:
			for i in range(len(w)):
				if 'u' == w[i:i + 1]:
					w = w[:i] + 'oo' + w[i + 1:]
	s.add(w)
print(len(s))


c = []
n = int(input())
for uygf in range(n):
	s = list(input())
	l = len(s)
	i = 0
	p = []
	d = ['u', 'o', 'k', 'h']
	while i < l:
		if s[i] not in d:
			p.append(s[i])
			i += 1
		elif s[i] == 'u':
			p.append('o')
			p.append('o')
			i += 1
		elif s[i] == 'k':
			y = i + 1
			while y < l and s[y] == 'k':
				y += 1
			if y != l:
				if s[y] == 'h':
					p.append('h')
					i = y + 1
				else:
					for pp in range(i, y):
						p.append('k')
					i = y
			else:
				for pp in range(i, y):
					p.append('k')
				i = y
		else:
			p.append(s[i])
			i += 1
	c.append(p)
d = []
for i in range(n):
	if i in d:
		continue
	for j in range(i + 1, n):
		if c[i] == c[j]:
			d.append(j)
print(n - len(d))


def uoo(x):
	newuser = []
	for i in x:
		if i == 'u':
			newuser.append('oo')
		else:
			newuser.append(i)
	return ''.join(newuser)

def khh(x):
	newuser = []
	kcount = 0
	kflag = False
	for i in x:
		if i == 'k':
			kflag = True
			kcount += 1
		else:
			if kflag:
				if i == 'h':
					newuser.append(i)
				else:
					for j in range(kcount):
						newuser.append('k')
					newuser.append(i)
			else:
				newuser.append(i)
			kcount = 0
			kflag = False
	if kflag:
		for j in range(kcount):
			newuser.append('k')
	return ''.join(newuser)
n = int(input())
usernames = set()
duplicates = 0
for _ in range(n):
	user = input()
	user = uoo(user)
	user = khh(user)
	if user in usernames:
		duplicates += 1
	else:
		usernames.add(user)
print(len(usernames))


n = int(input())
s = set()
for a in range(n):
	name = input()
	name = name.replace('u', 'oo')
	while name.count('kh') > 0:
		name = name.replace('kh', 'h')
	s.add(name)
print(len(s))


import re
n = int(input())
st = set()
for i in range(n):
	s = input()
	s = s.replace('u', 'oo')
	s = re.sub('k*h', 'h', s)
	st.add(s)
print(len(st))


def check(result, s, i):
	while True:
		if s == result[i]:
			return True
		elif s.count('h') > 0 and result[i].count('kh') > 0 and (len(s) < len(result[i])):
			s.replace('h', 'kh')
		elif s.count('kh') > 0 and result[i].count('h') > 0 and (len(s) > len(result[i])):
			result[i].replace('h', 'kh')
		else:
			return False
n = int(input(''))
s = list()
for _ in range(n):
	temp = input('').replace('u', 'oo')
	while temp.count('kh') > 0:
		temp = temp.replace('kh', 'h')
	s.append(temp)
result = list()
for temp in s:
	flag = False
	for i in result:
		if temp == i:
			flag = True
			break
	if not flag:
		result.append(temp)
print(len(result))


import re
print(len(set(map(lambda v: re.sub('k*h', 'h', input()).replace('u', 'oo'), range(int(input()))))))


import re

def cut(s):
	meetH = False
	result = []
	for i in range(len(s) - 1, -1, -1):
		if not meetH and s[i] == 'h':
			meetH = True
			result.append(s[i])
			continue
		elif meetH and s[i] == 'k':
			continue
		elif meetH and s[i] != 'k':
			result.append(s[i])
			continue
		elif not meetH and s[i] != 'h':
			result.append(s[i])
	result.reverse()
	s = ''.join(result)
	return s
d = {}
n = int(input())
for i in range(n):
	s = input().replace('u', 'oo')
	s = re.sub('k+h', 'h', s)
	if s not in d:
		d[s] = 0
	d[s] += 1
print(len(d))


n = int(input())
names = {}
for i in range(n):
	s = input()
	while s.find('kh') != -1:
		s = s.replace('kh', 'h')
	while s.find('u') != -1:
		s = s.replace('u', 'oo')
	names[s] = 1
print(len(names))


import re
s = input()
w = ['']
c = 0
for n in range(int(s)):
	_str = input()
	_str = re.sub('u', 'oo', _str)
	_str = re.sub('k+h', 'h', _str)
	found = False
	for sl in w:
		if sl == _str:
			found = True
			break
	if found == False:
		w.append(_str)
		c = c + 1
print(c)


n = int(input())
groups = {}
for i in range(0, n):
	words = []
	word = input()
	tword = word
	word = word.replace('u', 'oo')
	while word.find('kh') != -1:
		word = word.replace('kh', 'h')
	if groups.get(word, 0) is 0:
		groups.update({word: [tword]})
	else:
		words = groups.get(word)
		words.append(tword)
		groups.update({word: words})
print(len(groups.keys()))


n = int(input())
st = set()
for i in range(n):
	s = input()
	s = s.replace('u', 'oo')
	for j in range(30, 0, -1):
		t = str('k' * j + 'h')
		s = s.replace(t, 'h')
	st.add(s)
print(len(st))


d = dict()
for _ in ' ' * int(input()):
	z = input()
	while 'kh' in z:
		z = z.replace('kh', 'h')
	while 'u' in z:
		z = z.replace('u', 'oo')
	d[z] = d.get(z, 0) + 1
print(len(d))


m = int(input())
st = list()
for i in range(0, m):
	s = input()
	st.append(s)
for i in range(0, len(st)):
	s = st[i]
	while 'u' in s:
		s = s.replace('u', 'oo')
	while 'kh' in s:
		s = s.replace('kh', 'h')
	st[i] = s
wds = set(st)
print(len(wds))


n = int(input())
use = set()
for i in range(n):
	s = ''
	fl = False
	for j in input()[::-1]:
		if fl and j == 'k':
			continue
		elif j == 'u':
			s += 'oo'
			fl = False
		elif j == 'h':
			fl = True
			s += 'h'
		else:
			s += j
			fl = False
	use.add(s[::-1])
print(len(use))


n = int(input())
arr = []
count = 0
for i in range(n):
	x = input()
	while 'kh' in x:
		x = x.replace('kh', 'h')
	while 'u' in x:
		x = x.replace('u', 'oo')
	if x not in arr:
		count += 1
		arr.append(x)
print(count)


n = int(input())
l = []
for i in range(n):
	l.append(list(str(input())))
for i in range(n):
	for j in range(len(l[i])):
		if l[i][j] == 'u':
			l[i][j] = 'oo'
for i in range(n):
	j = 0
	count = 1
	while count != 0:
		count = 0
		for j in range(len(l[i]) - 1):
			if l[i][j] == 'k' and (l[i][j + 1] == 'h' or l[i][j + 1] == ''):
				l[i][j] = ''
				count += 1
for i in range(n):
	l[i] = ''.join(l[i])
s = set(l)
print(len(s))


def rev(s):
	s = s[::-1]
	news = []
	for i in range(len(s)):
		letter = s[i]
		if letter == 'u':
			news.append('o')
			news.append('o')
			continue
		if i == 0:
			news.append(letter)
			continue
		if letter == 'k':
			if news[-1] == 'h':
				continue
			news.append(letter)
			continue
		news.append(letter)
	return ''.join(news[::-1])
n = int(input())
g = set()
for i in range(n):
	s = input()
	s = rev(s)
	g.add(s)
print(len(g))


def solve():
	n = int(input())
	words = {}
	for i in range(n):
		word = input()
		while 'u' in word:
			word = word.replace('u', 'oo')
		while 'kkh' in word:
			word = word.replace('kkh', 'kh')
		if 'kh' in word:
			word = word.replace('kh', 'h')
		if word not in words:
			words[word] = 1
		else:
			words[word] += 1
	print(len(words))
solve()


n = int(input())
names = []
for i in range(n):
	prvs_name = input()
	new_name = ''
	while prvs_name != new_name:
		new_name = prvs_name
		prvs_name = prvs_name.replace('oo', 'u')
		prvs_name = prvs_name.replace('kh', 'h')
		prvs_name = prvs_name.replace('ou', 'uo')
	if new_name not in names:
		names.append(new_name)
print(len(names))


n = int(input())
ans = []
for i in range(0, n):
	s = input()
	s = s.replace('u', 'oo')
	while s.count('kh') != 0:
		s = s.replace('kh', 'h')
	if not s in ans:
		ans.append(s)
print(len(ans))


import math
import re

def ria():
	return [int(i) for i in input().split()]

def ri():
	return int(input())

def rfa():
	return [float(i) for i in input().split()]
eps = 1e-09

def is_equal(a, b):
	return abs(a - b) <= eps

def distance(p0, p1):
	return math.sqrt((p0[0] - p1[0]) ** 2 + (p0[1] - p1[1]) ** 2)
n = ri()
mp = {}
ar = []
for i in range(401, -1, -1):
	ar.append('k' * i + 'h')
for i in range(n):
	st = input()
	st = st.replace('u', 'oo')
	for j in range(1, len(ar)):
		st = st.replace(ar[j - 1], ar[j])
	mp[st] = 1
print(len(mp))


n = int(input())
sset = set()
for i in range(n):
	s = input()
	new = ''
	for j in s:
		if j == 'u':
			new += 'oo'
		else:
			new += j
	fl = True
	while fl:
		fl = False
		s = new[:]
		new = ''
		j = 0
		while j < len(s):
			if j < len(s) - 1 and s[j:j + 2] == 'kh':
				new += 'h'
				j += 2
				fl = True
			elif j < len(s) - 1 and s[j:j + 2] == 'oo':
				new += 'u'
				j += 2
				fl = True
			else:
				new += s[j]
				j += 1
	sset.add(new)
print(len(sset))


from sys import *
n = int(next(stdin))
words = []
for i in range(n):
	word = next(stdin).strip()
	word = word.replace('u', 'oo')
	while 'kh' in word:
		word = word.replace('kh', 'h')
	if word not in words:
		words.append(word)
print(len(words))


d = {}
for _ in range(int(input())):
	s = input()
	s = s.replace('u', 'oo')
	while 'kh' in s:
		s = s.replace('kh', 'h')
	d[s] = True
print(len(d.keys()))


d = {}
n = int(input())

def simpler(word):
	p = 0
	while p <= len(word):
		if word[p:p + 1] == 'u':
			word = word[:p] + 'oo' + word[p + 1:]
			p = 0
		elif word[p:p + 2] == 'kh':
			word = word[:p] + 'h' + word[p + 2:]
			p = 0
		else:
			p += 1
	return word
for i in range(n):
	word = simpler(input())
	if word not in d:
		d[word] = 1
	else:
		d[word] = d[word] + 1
print(len(d))


t = int(input())
arr = []
for i in range(t):
	s = input()
	s = s.replace('u', 'oo')
	f = 0
	while f != -1:
		s = s.replace('kh', 'h')
		f = s.find('kh')
	arr.append(s)
arr = set(arr)
print(len(arr))


t = int(input())
l = []
p = ['kkkkkkkkkkkkkkkkkkkh', 'kkkkkkkkkkkkkkkkkkh', 'kkkkkkkkkkkkkkkkkh', 'kkkkkkkkkkkkkkkkh', 'kkkkkkkkkkkkkkkh', 'kkkkkkkkkkkkkkh', 'kkkkkkkkkkkkkh', 'kkkkkkkkkkkkh', 'kkkkkkkkkkkh', 'kkkkkkkkkkh', 'kkkkkkkkkh', 'kkkkkkkkh', 'kkkkkkkh', 'kkkkkkh', 'kkkkkh', 'kkkkh', 'kkkh', 'kkh', 'kh']
for i in range(0, t):
	s = str(input())
	a = s.replace('u', 'oo')
	for j in p:
		if j in s:
			a = a.replace(j, 'h')
	if a not in l:
		l.append(a)
print(len(l))


n = int(input())
set1 = set()
for i in range(n):
	inp = input()
	while 'oo' in inp:
		inp = inp.replace('oo', 'u')
	while 'kh' in inp:
		inp = inp.replace('kh', 'h')
	set1.add(inp)
set2 = set()
for st in set1:
	set2.add(st.replace('u', 'oo').replace('h', 'kh'))
print(len(set2))


n = int(input())
se = set()
for i in range(n):
	s = input()
	while s.find('u') != -1:
		s = s.replace('u', 'oo')
	while s.find('kh') != -1:
		s = s.replace('kh', 'h')
	se.add(s)
print(len(se))


import sys
import re

def simplify(w):
	w = re.sub('oo', 'u', w)
	w = re.sub('ou', 'uo', w)
	w = re.sub('kh', 'h', w)
	return w

def ultra_simplify(w):
	nw = simplify(w)
	while nw != w:
		w = nw
		nw = simplify(w)
	return nw
N = int(next(sys.stdin))
words = list(sys.stdin)
words = [ultra_simplify(w.strip()) for w in words]
print(len(set(words)))


def replacement(str):
	str2 = str.replace('oo', 'u')
	str3 = str2.replace('kh', 'h')
	if str3 == str:
		return str3
	else:
		str3 = replacement(str3)
		return str3
n = int(input())
myList = []
myList2 = []
for i in range(n):
	myList.append(input())
for x in myList:
	str4 = replacement(x)
	str4 = str4.replace('u', 'oo')
	str4 = str4.replace('h', 'kh')
	exist = False
	for str in myList2:
		if str4 == str:
			exist = True
	if exist == False:
		myList2.append(str4)
print(len(myList2))


st = set()
for i in range(int(input())):
	s = input().replace('u', 'oo').replace('oo', 'u')
	while s.count('kh') > 0:
		s = s.replace('kh', 'h')
	st.add(s)
print(len(st))


def amb1(s):
	l = list(s)
	s1 = s
	l1 = list(s1)
	while 'kh' in s1:
		l1 = list(s1)
		for i in range(len(l1) - 1):
			if l1[i] == 'k' and l1[i + 1] == 'h':
				l1 = l1[:i] + l1[i + 1:]
				s1 = ''.join(l1)
				break
	return ''.join(l1)

def amb2(s):
	l = list(s)
	s1 = s
	l1 = list(s1)
	while 'u' in s1:
		l1 = list(s1)
		for i in range(len(l1)):
			if l1[i] == 'u':
				l1 = l1[0:i] + ['o', 'o'] + l1[i + 1:]
				s1 = ''.join(l1)
				break
	return ''.join(l1)
n = int(input())
l = []
for i in range(n):
	s = str(input())
	while 'kh' in s or 'u' in s:
		if 'kh' in s:
			s = amb1(s)
		if 'u' in s:
			s = amb2(s)
	l.append(s)
ll = set(l)
print(len(ll))


def conv(s):
	s = s.replace('u', 'oo')
	while 'kh' in s:
		s = s.replace('kh', 'h')
	return s
n = int(input())
arr = set()
for i in range(n):
	s = input()
	arr.add(conv(s))
print(len(arr))


import re

def fix(s):
	s = s.replace('u', 'oo')
	s = s.replace('oo', 'u')
	s = re.sub('k+h', 'h', s)
	return s
words = set()
for i in range(int(input())):
	words.add(fix(input()))
print(len(words))


n = int(input())
r = dict()
for i in range(n):
	s = input()
	w = ''
	k = 0
	o = 0
	for c in s:
		if c not in ('h', 'k', 'u', 'o'):
			if k > 0:
				w += 'k' * k
				k = 0
			if o > 0:
				w += '(' + str(o) + ')'
				o = 0
			w += c
		if c == 'h':
			if o > 0:
				w += '(' + str(o) + ')'
				o = 0
			if k > 0:
				k = 0
			w += 'h'
		if c == 'k':
			if o > 0:
				w += '(' + str(o) + ')'
				o = 0
			k += 1
		if c == 'u':
			if k > 0:
				w += 'k' * k
				k = 0
			o += 2
		if c == 'o':
			if k > 0:
				w += 'k' * k
				k = 0
			o += 1
	if k > 0:
		w += 'k' * k
		k = 0
	if o > 0:
		w += '(' + str(o) + ')'
		o = 0
	r[w] = r.get(w, 0) + 1
print(len(r))


def f(_):
	s = input()
	s = s.replace('u', 'oo').replace('oo', 'u')
	for _ in range(len(s)):
		s = s.replace('kh', 'h')
	return s
print(len(set(map(f, range(int(input()))))))


n = int(input())
s = [str(input()) for i in range(n)]
a = set()
for x in s:
	while 'oo' in x or 'uo' in x:
		if 'oo' in x:
			i = x.find('oo')
			x = x[:i] + 'u' + x[i + 2:]
		if 'uo' in x:
			i = x.find('uo')
			x = x[:i] + 'ou' + x[i + 2:]
	while 'kh' in x:
		i = x.find('kh')
		x = x[:i] + 'h' + x[i + 2:]
	a.add(x)
print(len(a))


n = int(input())
a = {}
count = 0
while n:
	n -= 1
	s = input()
	while 'u' in s:
		s = s.replace('u', 'oo')
	while 'kh' in s:
		s = s.replace('kh', 'h')
	try:
		a[s] += 1
	except KeyError:
		a[s] = 1
		count += 1
print(count)


n = int(input())
words = []
for _ in range(n):
	replace = True
	word = input()
	while replace:
		newWord = word.replace('u', 'oo').replace('kh', 'h')
		if word == newWord:
			replace = False
		word = newWord
	if word not in words:
		words.append(word)
print(len(words))


n = int(input())
e = set()
for i in range(n):
	s = input()
	while 1:
		s1 = s
		s = s.replace('u', 'oo').replace('kh', 'h')
		if s == s1:
			break
	e.add(s)
print(len(e))


n = int(input())
words = [None] * n
for i in range(n):
	cur = input()
	if 'u' in cur:
		cur = cur.replace('u', 'oo')
	if 'kh' in cur:
		while 'kh' in cur:
			cur = cur.replace('kh', 'h')
	words[i] = cur
print(len(set(words)))


n = int(input())
res = set()
for _ in range(n):
	s = input().replace('u', 'oo')
	while True:
		ns = s.replace('kh', 'h')
		if ns == s:
			s = ns
			break
		s = ns
	res.add(s)
print(len(res))


n = int(input())
words = {}
for i in range(n):
	w = input()
	while 'kh' in w or 'u' in w:
		w = w.replace('u', 'oo').replace('kh', 'h')
	try:
		words[w] += 1
	except KeyError:
		words[w] = 1
print(len(words.keys()))


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
N = int(input())
A = []
for i in range(N):
	A.append(input())

def transform(s):
	t = []
	for c in s:
		if c == 'u':
			t.append('oo')
		elif c == 'h':
			while t and t[-1] == 'k':
				t.pop()
			t.append('h')
		else:
			t.append(c)
	return ''.join(t)
C = set()
for s in A:
	C.add(transform(s))
print(len(C))


n = int(input())
names = dict()
for i in range(n):
	s = input()
	tp = []
	ks = 0
	l = len(s)
	tp = []
	flag = 0
	for i in range(l):
		if s[i] == 'k':
			ks += 1
			flag = 1
		else:
			if s[i] == 'h' and flag == 1:
				tp.append('h')
			else:
				tp.append('k' * ks)
				if s[i] == 'u':
					tp.append('oo')
				else:
					tp.append(s[i])
			ks = 0
			flag = 0
	if ks:
		tp.append('k' * ks)
	s = ''.join(tp)
	if s not in list(names.keys()):
		names[s] = 1
print(len(names))


l = []
n = int(input())
for k in range(n):
	a = input()
	for k in range(len(a)):
		a = a.replace('u', 'oo')
		a = a.replace('kh', 'h')
	l += [a]
print(len(set(l)))


import re
n = int(input())
l = {}
for i in range(n):
	s = input()
	s = re.sub('u', 'oo', s)
	s = re.sub('k*h', 'h', s)
	l[s] = 1
print(len(l))


n = int(input())
dict_ch = {}
for i in range(n):
	ch = input()
	if 'u' in ch:
		ch = ch.replace('u', 'oo')
	while 'kh' in ch:
		ch = ch.replace('kh', 'h')
	if ch not in dict_ch:
		dict_ch.update({ch: 1})
print(len(dict_ch))


n = int(input())
s = set()
for i in range(n):
	v = input()
	for (rf, rt) in [('kh', 'h'), ('uo', 'ou'), ('oo', 'u'), ('uo', 'ou')]:
		while rf in v:
			v = v.replace(rf, rt)
	s.add(v)
print(len(s))


def expand(x):
	x = x.replace('u', 'oo')
	x = x.replace('h', 'kh')
	return x

def reduce(x):
	nx = ''
	while True:
		nx = x.replace('oo', 'u')
		if nx == x:
			break
		x = nx
	while True:
		nx = x.replace('kh', 'h')
		if nx == x:
			break
		x = nx
	if 'oo' in x or 'kh' in x:
		x = reduce(x)
	return x
n = int(input())
l = []
for _ in range(n):
	l.append(input())
s = set()
for x in l:
	s.add(reduce(expand(x)))
print(len(s))


names = int(input())

def simplify_name(s):
	s_orig = s[:]
	s = s.replace('u', 'oo')
	s = s.replace('kh', 'h')
	if s == s_orig:
		return s
	else:
		return simplify_name(s)
name_set = set()
for idx in range(names):
	name_set.add(simplify_name(input()))
print(len(name_set))


import sys
n = int(input())
s = set()
for line in sys.stdin:
	prev = line
	while True:
		word = prev.strip().replace('oo', 'u').replace('kh', 'h').replace('uo', 'ou')
		if prev == word:
			break
		else:
			prev = word
	s.add(prev)
print(len(s))


n = int(input())
st = set()
for i in range(n):
	s = input()
	t = s.replace('kh', 'h')
	while t != s:
		s = t
		t = s.replace('kh', 'h')
	st.add(t.replace('u', 'oo'))
print(len(st))


n = int(input())
s = set()
for i in range(n):
	cur = input()
	ref = ''
	for c in cur:
		if c == 'u':
			ref = ref + 'oo'
		else:
			ref = ref + c
	while True == True:
		check = True
		tmp = ''
		for c in range(0, len(ref)):
			if c != len(ref) - 1 and ref[c] == 'k' and (ref[c + 1] == 'h'):
				check = False
			else:
				tmp = tmp + ref[c]
		ref = tmp
		if check == True:
			break
	s.add(ref)
print(len(s))


def main():
	n = int(input())
	l = list()
	for i in range(n):
		tmp = input()
		tmp = kh(tmp)
		tmp = tmp.replace('u', 'oo')
		tmp = tmp.replace('oo', 'u')
		if tmp not in l:
			l.append(tmp)
	print(len(l))

def kh(tmp):
	if 'kh' not in tmp:
		return tmp
	else:
		return kh(tmp.replace('kh', 'h'))
main()


n = int(input())
d = {}
for _ in range(n):
	s = input()
	while True:
		if s.find('kh') != -1:
			s = s.replace('kh', 'h')
		elif s.find('u') != -1:
			s = s.replace('u', 'oo')
		else:
			break
	d[s] = d.get(s, 0) + 1
print(len(d))


from sys import stdin
words = set()

def ko(w):
	while 'kh' in w:
		w = w.replace('kh', 'h', 1)
	return w.replace('u', 'oo')

def solve():
	inp = stdin.read().strip().split()[1:]
	for w in inp:
		words.add(ko(w))
	print(len(words))
solve()


n = int(input())
s = set()
for i in range(n):
	t = input()
	tmp = ''
	j = 0
	while j < len(t):
		if t[j] == 'u':
			tmp += 'oo'
			j += 1
		else:
			tmp += t[j]
			j += 1
	t = tmp
	tmp = ''
	j = len(t) - 1
	while j >= 0:
		if j >= 0 and t[j] == 'h' and (t[j - 1] == 'k'):
			j -= 1
			k = j
			tmp += 'h'
			while k >= 0 and t[k] == 'k':
				k -= 1
				j -= 1
		else:
			tmp += t[j]
			j -= 1
	s.add(''.join(tmp[::-1]))
print(len(s))


import re
print(len(set((re.sub('k*h', 'h', input()).replace('u', 'oo') for i in range(int(input()))))))


n = int(input())

def get_final_str(s):
	s = s.replace('u', 'oo')
	while 1:
		s1 = s.replace('kh', 'h')
		if s1 == s:
			break
		s = s1
	return s
d = set()
for i in range(n):
	s = get_final_str(input())
	d.add(s)
print(len(d))


n = int(input())
names = set()
for rd in range(n):
	prev_name = input()
	name = prev_name.replace('u', 'oo').replace('kh', 'h')
	while name != prev_name:
		prev_name = name
		name = name.replace('kh', 'h')
	names.add(name)
print(len(names))


name_number = int(input())
names = []
for name in range(name_number):
	entered_name = input()
	while 'kh' in entered_name:
		entered_name = entered_name.replace('kh', 'h')
	while 'u' in entered_name:
		entered_name = entered_name.replace('u', 'oo')
	names.append(entered_name)
print(len(set(names)))


c = set()
for _ in range(int(input())):
	a = input()
	a = a.replace('u', 'oo')
	while 'oo' in a:
		a = a.replace('oo', 'u')
	while 'kh' in a:
		a = a.replace('kh', 'h')
	c.add(a)
print(len(c))


def main():
	import re
	n = int(input())
	print(len({re.sub('(k+h)|u', lambda m: 'h' if m.group(1) else 'oo', input()) for i in range(n)}))
try:
	while True:
		main()
except EOFError:
	pass


n = int(input())
arr = []
for i in range(n):
	s = input()
	while 'u' in s or 'kh' in s:
		s = s.replace('u', 'oo')
		s = s.replace('kh', 'h')
	if not s in arr:
		arr.append(s)
print(len(arr))


n = int(input())
i = 1
words = []
words2 = []
res = set()
while i <= n:
	words.append(input())
	i += 1
for i in range(n):
	words2 = words[i]
	while 'u' in words2:
		words2 = words2.replace('u', 'oo')
	while 'kh' in words2:
		words2 = words2.replace('kh', 'h')
	res.add(words2)
print(len(res))


n = input()
names = set()
for i in range(0, int(n)):
	s = input()
	while 'kh' in s:
		s = s.replace('kh', 'h')
	while 'u' in s:
		s = s.replace('u', 'oo')
	names.add(s)
print(len(names))


t = int(input())
li = []
for _ in range(t):
	li.append(input().replace('u', 'oo'))
for _ in range(t):
	while 'kh' in li[_]:
		li[_] = li[_].replace('kh', 'h')
dict = {}
for _ in range(t):
	dict[li[_]] = 1
print(len(dict))


import sys
n = int(input())
names = []
for _ in range(n):
	names.append(input())
other = []
for name in names:
	while 'u' in name:
		name = name.replace('u', 'oo')
	while 'kh' in name:
		name = name.replace('kh', 'h')
	other.append(name)
print(len(set(other)))


n = int(input().strip())
A = []
for i in range(n):
	A.append(input().strip())
A = list(map(lambda x: x.replace('u', 'oo'), A))
for i in range(n):
	tem = A[i]
	toRem = []
	for j in range(len(tem)):
		if tem[j] == 'h':
			lo = None
			for k in range(j - 1, -1, -1):
				if tem[k] == 'k':
					lo = k
				else:
					break
			if not lo is None:
				toRem.append([lo, j])
	if toRem:
		for j in range(len(toRem) - 1, -1, -1):
			tem = tem[:toRem[j][0]] + tem[toRem[j][1]:]
	A[i] = tem
A.sort()
if A:
	out = 1
for i in range(1, len(A)):
	if A[i] != A[i - 1]:
		out += 1
print(out)


n = int(input())
g = set()
for _ in range(n):
	s = input()
	while True:
		new_s = s.replace('oo', 'u').replace('kh', 'h').replace('ou', 'uo')
		if new_s == s:
			break
		s = new_s
	if s not in g:
		g.add(s)
print(len(g))


n = int(input())
v = [input() for _ in range(n)]
vis = set()

def min(s):
	if s in vis:
		return 0
	vis.add(s)
	if s.find('kh') != -1:
		ind = s.find('kh')
		nstr = s[:ind] + 'h' + s[ind + 2:]
		return min(nstr)
	if s.find('u') != -1:
		ind = s.find('u')
		nstr = s[:ind] + 'oo' + s[ind + 1:]
		return min(nstr)
	return 1
ans = 0
for s_ in v:
	ans += min(s_)
print(ans)


import re
n = int(input())
names = set()
for i in range(n):
	word = input()
	word = re.sub('k*h', '%', word)
	word = word.replace('u', 'oo')
	names.add(word)
print(len(names))


def k(s):
	a = ''
	temp = 0
	for i in range(len(s)):
		if s[i] == 'k' and s[i - 1] != 'k' and (i != len(s) - 1):
			temp = i
		elif s[i] == 'k' and s[i - 1] != 'k' and (i == len(s) - 1):
			a += 'k'
		elif s[i] == 'k' and s[i - 1] == 'k' and (i != len(s) - 1):
			continue
		elif s[i] == 'h' and s[i - 1] == 'k':
			a += s[i]
		elif s[i] != 'h' and s[i - 1] == 'k':
			a += s[temp:i + 1]
		elif s[i] == 'k' and s[i - 1] == 'k' and (i == len(s) - 1):
			a += s[temp:i + 1]
		else:
			a += s[i]
	return a

def u(s):
	a = ''
	for i in s:
		if i == 'u':
			a += 'oo'
		else:
			a += i
	return a
n = int(input())
s = set()
for i in range(n):
	temp = input()
	t2 = u(k(temp))
	s.add(t2)
print(len(s))


(c, m) = (0, [])
imya = int(input())
while c != imya:
	m.append(input())
	c += 1
for i in range(len(m)):
	while 'kh' in m[i] or 'u' in m[i]:
		m[i] = m[i].replace('kh', 'h')
		m[i] = m[i].replace('u', 'oo')
print(str(len(set(m))))


from collections import defaultdict
n = int(input())
w = []
for i in range(n):
	w.append([j for j in input()])
g = defaultdict(int)
for i in range(n):
	moved = True
	w1 = w[i].copy()
	while moved:
		moved = False
		for j in range(len(w1) - 1, 0, -1):
			if w1[j] == 'h' and w1[j - 1] == 'k':
				w1.pop(j)
				w1 = w1[:j] + ['h'] + w1[j:]
				w1.pop(j - 1)
				moved = True
		for j in range(len(w1) - 1, -1, -1):
			if w1[j] == 'u':
				w1.pop(j)
				w1 = w1[:j] + ['o'] + ['o'] + w1[j:]
				moved = True
	w1 = ''.join(w1)
	g[w1] += 1
print(len(g))


import re
t = int(input())
dd = {}
for i in range(0, t):
	s = input()
	s = re.sub('[k]+h', 'h', s.rstrip())
	s = re.sub('u', 'oo', s.rstrip())
	dd[s] = 1
print(len(dd))


n = int(input())
lst = []
for i in range(n):
	lst.append(list(input()))
cnt = 0
ans = []
for i in range(n):
	if lst[i] != -1:
		cnt = 1
		for j in range(n):
			if i != j and lst[j] != -1:
				s1 = ''.join(lst[i])
				s2 = ''.join(lst[j])
				f = 0
				while 'u' in s1 or 'u' in s2 or 'kh' in s1 or ('kh' in s2):
					s1 = s1.replace('kh', 'h')
					s2 = s2.replace('kh', 'h')
					s1 = s1.replace('u', 'oo')
					s2 = s2.replace('u', 'oo')
				if s1 == s2:
					cnt += 1
					lst[j] = -1
		ans.append(cnt)
		lst[i] = -1
print(len(ans))


n = int(input())
a = set()
while n:
	s = input()
	s = s.replace('u', 'oo')
	s = s.replace('oo', 'u')
	t = s
	s = s.replace('kh', 'h')
	while t != s:
		t = s
		s = s.replace('kh', 'h')
	a.add(s)
	n -= 1
print(len(a))


n = int(input())
l = []
for i in range(n):
	l.append(list(input().strip()))
ans = 1
for i in range(n):
	j = len(l[i]) - 1
	if len(l[i]) == 1:
		if l[i][0] == 'u':
			l[i] = ['o', 'o']
		else:
			continue
	while j > 0:
		if l[i][j] == 'h' and l[i][j - 1] == 'k':
			l[i][j - 1:j + 1] = ['h']
		j -= 1
	j = 0
	while True:
		try:
			if l[i][j] == 'u':
				l[i][j:j + 1] = ['o', 'o']
				j += 1
		except:
			break
		j += 1
l.sort()
for i in range(n - 1):
	if l[i] != l[i + 1]:
		ans += 1
print(ans)


n = int(input())
s = []
for i in range(n):
	tmp = str(input())
	for j in range(20):
		tmp = tmp.replace('u', 'oo')
		tmp = tmp.replace('kh', 'h')
	s.append(tmp)
print(len(set(s)))


n = int(input())
a = set()
for i in range(n):
	s = input().rstrip()
	while s.find('kh') != -1:
		s = s.replace('kh', 'h')
	while s.find('u') != -1:
		s = s.replace('u', 'oo')
	a.add(s)
print(len(list(a)))