import itertools S = [str(x) for x in str(input())] L = list(itertools.permutations(S)) M = [] for x in L: M.append("".join(x)) print(len(set(M))-1)