from math import factorial as fact from collections import Counter cnt = Counter(raw_input()) d = 1 s = 0 for c in cnt.values(): d *= fact(c) s += c print fact(s)/d - 1