n = int(input()) T = [] se = set() for _ in range(n): S = input() lst = [ord(s) - 96 for s in S] tot = 0 for l in lst: tot *= 26 tot += l se.add(tot) T.append(lst) for lst in T: ans = 0 times = 1 tot = 0 for l in lst: tot *= 26 tot += l se.add(tot) for l in lst[::-1]: tot -= times * l for j in range(1, 27): if j == l: pass else: tot += times * j if tot in se: ans += 1 tot -= times * j tot += times * l times *= 26 print(ans)