from itertools import permutations s = input() print(len(set(permutations(s)))-1)