import itertools S = list(raw_input()) thelist = itertools.permutations(S) print len(set(thelist)) - 1