from itertools import * S = input() SS = set() for tup in permutations(S): SS.add("".join(tup)) print(len(SS) - 1)