N,*S=open(0);S=[s.strip() for s in S] print(len(set([a+b for a in S for b in S if a!=b])))