#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   long long dx[] = {-1, 0, 1, 0};   long long dy[] = {0, -1, 0, 1};   vector<long long> v(10);   string s;   set<string> st;   void call(string s, long long pos) {     if (pos == 10) {       sort(s.begin(), s.end());       st.insert(s);       return;     }     if (v[pos] == 0) {       call(s, pos + 1);       return;     }     for (long long i = 1; i <= v[pos]; i++) {       char c =  0  + pos;       string x = string(i, c);       call(s + x, pos + 1);     }   }   int32_t main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     vector<long long> f(20);     f[0] = f[1] = 1;     for (long long i = 2; i < 20; i++) {       f[i] = f[i - 1] * i;     }     cin >> s;     for (long long i = 0; i < s.size(); i++) v[s[i] -  0 ]++;     string x =   ;     call(x, 0);     long long ans = 0;     for (auto i : st) {       string &x = i;       vector<long long> cnt(10);       for (long long i = 0; i < x.size(); i++) {         cnt[x[i] -  0 ]++;       }       long long val = f[x.size()];       for (long long i = 0; i < 10; i++) {         val = val / f[cnt[i]];       }       ans += val;       if (v[0] > 0) {         long long val1 = f[x.size() - 1];         cnt[0]--;         for (long long i = 0; i < 10; i++) val1 = val1 / f[cnt[i]];         ans -= val1;       }     }     cout << ans <<   n ;   }   