n=int(input()) ss=[] d={} for i in range(n): s=list(input()) if tuple(s) not in d: d[tuple(s)]=0 d[tuple(s)]+=1 ss+=[s] for i in range(n): s=ss[i] c=0 for j in range(len(s)): t=s[j] for k in range(26): s[j]=chr(k+ord("a")) if tuple(s) in d: c+=d[tuple(s)]*(chr(k+ord("a"))!=t) s[j]=t print(c)