from itertools import permutations s=list(input()) l=list(permutations(s)) p=[] for x in l: x="".join(x) p.append(x) print(len(list(set(p)))-1)