n,*s=open(0).read().split() p=set() for i in s:p|=set(map(lambda x:x+i,s)) print(len(p)-int(n))