from itertools import permutations S = input() s = set() for p in permutations(S): s.add(p) print(len(s)-1)