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