#include #include #include #include #include #include #include #include #include #define rep(i, a) FOR(i, 0, a) #define FOR(i, a, b) for(int i = a; i < b; ++i) typedef long long ll; typedef unsigned long long ull; typedef std::pair P; struct edge{ int to, time, cost; }; std::string str; int kaijo[9]; int main(){ kaijo[0] = 1; FOR(i, 1, 9)kaijo[i] = kaijo[i - 1] * i; std::cin >> str; std::sort(str.begin(), str.end()); int ans = kaijo[str.size()]; int cnt = 1; FOR(i, 1, str.size()){ if (str[i] == str[i - 1])++cnt; else { ans /= kaijo[cnt]; cnt = 1; } } ans /= kaijo[cnt]; std::cout << ans - 1 << std::endl; return 0; }