#include <bits/stdc++.h>
using namespace std;
long long fac(long long r) {
  long long s = 1;
  if (r == 0 || r == 1) return 1;
  for (long long i = 1; i <= r; i++) s *= i;
  return s;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long ans = 0;
  string s;
  cin >> s;
  long long n = s.size();
  long long arr[n];
  long long bigi = 0;
  long long tab[10] = {0};
  for (long long i = 0; i < n; i++) {
    arr[i] = s[i] - '0', tab[arr[i]]++;
    if (tab[arr[i]] == 1) bigi++;
  }
  set<vector<long long> > se2;
  reverse(arr, arr + n);
  for (long long i = 0; i < (1 << n); i++) {
    vector<long long> v3;
    long long co = 0, co2 = 0;
    long long tab2[10] = {0};
    for (long long j = 0; j < n; j++) {
      if (i & (1 << j)) {
        v3.push_back(arr[j]);
        co++;
        tab2[arr[j]]++;
        if (tab2[arr[j]] == 1) co2++;
      }
    }
    sort(v3.begin(), v3.end());
    if (co2 == bigi)
      if (!se2.count(v3)) {
        se2.insert(v3);
        long long r = 0;
        vector<long long> v;
        for (long long j = 0; j < 10; j++) {
          if (tab2[j] > 0) v.push_back(tab2[j]);
        }
        long long d;
        if (tab2[0] == 0) {
          d = fac(co);
          for (long long j = 0; j < v.size(); j++) d /= fac(v[j]);
          ans += d;
        } else {
          d = fac(co);
          for (long long j = 0; j < v.size(); j++) d /= fac(v[j]);
          long long l = fac(co - 1);
          tab2[0]--;
          v.clear();
          for (long long j = 0; j < 10; j++) {
            if (tab2[j] > 0) v.push_back(tab2[j]);
          }
          for (long long j = 0; j < v.size(); j++) l /= fac(v[j]);
          ans += d - l;
        }
      }
  }
  cout << ans << endl;
}
