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