#include <bits/stdc++.h>
using namespace std;
long long fact[20];
long long f[10];
long long calc(string s) {
  long long c[10] = {0};
  for (long long i = 0; i < s.size(); i++) {
    c[s[i] - '0']++;
  }
  for (long long i = 0; i < 10; i++) {
    if (f[i] > 0 && c[i] == 0) {
      return 0;
    }
  }
  long long ans = fact[s.size()];
  for (long long i = 0; i < 10; i++) {
    ans /= (fact[c[i]]);
  }
  long long ans2 = 0;
  if (c[0] > 0) {
    ans2 = fact[s.size() - 1];
    c[0]--;
    for (long long i = 0; i < 10; i++) {
      ans2 /= fact[c[i]];
    }
  }
  return (ans - ans2);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  fact[0] = 1, fact[1] = 1;
  for (long long i = 2; i < 20; i++) {
    fact[i] = fact[i - 1] * i;
  }
  string s;
  cin >> s;
  for (long long i = 0; i < s.size(); i++) {
    f[s[i] - '0']++;
  }
  map<string, long long> m;
  long long ans = 0;
  for (long long i = 1; i < (1 << s.size()); i++) {
    string sub;
    for (long long j = 0; j < s.size(); j++) {
      if (i & (1 << j)) {
        sub += s[j];
      }
    }
    sort(sub.begin(), sub.end());
    if (!m[sub]) {
      ans += calc(sub);
      m[sub] = 1;
    }
  }
  cout << ans;
  return 0;
}
