import itertools S = raw_input() print len(set(itertools.permutations(S))) - 1