from itertools import permutations S = list(input().rstrip()) st = set() for v in permutations(S): st.add("".join(v)) print(len(st) - 1)