#include <bits/stdc++.h>
using namespace std;
int cnt[11], cntm[11];
long long fact[20];
string s;
set<string> st;
long long query() {
  for (int i = 0; i < 10; ++i) {
    if (cntm[i] and !cnt[i]) return 0;
  }
  sort(s.begin(), s.end());
  if (st.find(s) != st.end()) return 0;
  st.insert(s);
  long long ans = fact[s.length()];
  for (int i = 0; i < 10; ++i) {
    ans /= fact[cnt[i]];
  }
  if (cnt[0]) {
    long long ans2 = fact[s.length() - 1];
    for (int i = 1; i < 10; ++i) {
      ans2 /= fact[cnt[i]];
    }
    ans2 /= fact[cnt[0] - 1];
    ans -= ans2;
  }
  return ans;
}
int main() {
  fact[0] = 1;
  for (int i = 1; i < 20; ++i) {
    fact[i] = fact[i - 1] * (1ll * i);
  }
  string n;
  cin >> n;
  int l = n.length();
  for (int i = 0; i < l; ++i) {
    cntm[n[i] - '0']++;
  }
  long long ans = 0;
  for (int i = 0; i < (1 << l); ++i) {
    memset(cnt, 0, sizeof(cnt));
    s = "";
    for (int j = 0; j < l; ++j) {
      if ((1 << j) & i) {
        cnt[n[j] - '0']++;
        s += n[j];
      }
    }
    ans += query();
  }
  cout << ans << "\n";
  return 0;
}
