// 想定解: 全探索 #include <bits/stdc++.h> using namespace std; template<typename _T> void rc(_T v,_T mn,_T mx){if(v<mn||mx<v){cerr<<"error"<<endl;throw;}} #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) int main(){ string S; cin >> S; rc((int)S.size(), 1, 11); set<string> res; sort(S.begin(), S.end()); do { res.insert(S); } while(next_permutation(S.begin(), S.end())); cout << res.size()-1 << endl; }