N = int(input()) S = [] for _ in range(N): S.append(input()) ANS = [0]*N for i in range(N): for j in range(i+1,N): if len(S[i])==len(S[j]): v = 0 for k in range(len(S[i])): if S[i][k]!=S[j][k]: v+=1 if v==1: ANS[i]+=1 ANS[j]+=1 for ans in ANS: print(ans)