import itertools s = input() t = list(itertools.permutations(s)) t = set(t) print(len(t)-1)