#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;
ll mod_sum() { return 0LL; }
template <typename T, typename... Args>
T mod_sum(T a, Args... args) {
  return ((a + mod_sum(args...)) % mod + mod) % mod;
}
ll mod_prod() { return 1LL; }
template <typename T, typename... Args>
T mod_prod(T a, Args... args) {
  return (a * mod_prod(args...)) % mod;
}
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<ll> >;
using vvb = vector<vector<bool> >;
using vpii = vector<pii>;
using vvpii = vector<vector<pii> >;
ll solve() {
  vi fac(20);
  fac[0] = 1;
  for (ll i = 1; i < 20; i++) fac[i] = (i * fac[i - 1]);
  string str;
  cin >> str;
  string check = str;
  sort((check).begin(), (check).end());
  (check).resize(
      distance((check).begin(), unique((check).begin(), (check).end())));
  ll ans = 0;
  set<string> done;
  for (ll mask = 1; mask < (1 << str.size()); mask++) {
    string s;
    for (ll i = 0; i < (ll)str.size(); i++)
      if (mask & (1 << i)) s.push_back(str[i]);
    string scheck = s;
    sort((scheck).begin(), (scheck).end());
    (scheck).resize(
        distance((scheck).begin(), unique((scheck).begin(), (scheck).end())));
    if (scheck != check) continue;
    sort((s).begin(), (s).end());
    if (((done).find(s) != (done).end())) continue;
    done.insert(s);
    vi cnt(10);
    for (char x : s) cnt[x - '0']++;
    ll temp_ans = fac[s.size()];
    for (ll x : cnt) temp_ans /= fac[x];
    ans += temp_ans;
    if (cnt[0]) {
      cnt[0]--;
      s.erase(find((s).begin(), (s).end(), '0'));
      temp_ans = fac[s.size()];
      for (ll x : cnt) temp_ans /= fac[x];
      ans -= temp_ans;
    }
  }
  cout << ans << '\n';
  return 0;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll t = 1;
  while (t--) solve();
  return 0;
}
