import math f=math.factorial l=list(input()) s=set(l) a=f(len(l)) for c in s:a//=f(l.count(c)) print(a-1)