#include <bits/stdc++.h>
using namespace std;
long long po(long long a, long long b) {
  long long r = 1;
  while (b) {
    if (b & 1) {
      r *= a;
      r %= 1000000007;
    }
    a = a * a;
    b = b >> 1;
    a %= 1000000007;
  }
  return r;
}
long long ans;
long long cnt[10];
long long inv[100];
long long fact[100];
long long ori[100];
long long calc() {
  long long num = 0;
  vector<long long> v;
  for (long long i = 0; i < 10; i++) {
    num += cnt[i];
    v.push_back(cnt[i]);
  }
  long long ans = 1;
  long long i = 0;
  sort(v.begin(), v.end());
  while (i < v.size()) {
    if (v[i] <= 1) {
      i++;
      continue;
    }
    if (ans % v[i] == 0) {
      ans /= v[i];
      v[i]--;
      continue;
    }
    ans *= num;
    num--;
  }
  while (num) {
    ans *= num;
    num--;
  }
  return ans;
}
void go(long long i) {
  if (i == 10) {
    for (long long j = 1; j <= 9; j++) {
      if (cnt[j]) {
        cnt[j]--;
        ans += calc();
        cnt[j]++;
      }
    }
    return;
  }
  while (true) {
    if (cnt[i] == 0) {
      if (ori[i] == 0) {
        go(i + 1);
        return;
      }
      cnt[i] = ori[i];
      return;
    }
    go(i + 1);
    cnt[i]--;
  }
}
int main() {
  ans = 0;
  fact[0] = 1;
  for (long long i = 1; i < 100; i++) {
    fact[i] = (i * fact[i - 1]) % 1000000007;
  }
  inv[0] = 1;
  for (long long i = 1; i < 100; i++) {
    inv[i] = po(i, 1000000007 - 2) * inv[i - 1];
    inv[i] %= 1000000007;
  }
  string a;
  cin >> a;
  for (long long i = 0; i < 10; i++) cnt[i] = 0;
  for (long long i = 0; i < a.length(); i++) cnt[a[i] - '0']++;
  for (long long i = 0; i < 10; i++) ori[i] = cnt[i];
  go(0);
  cout << ans << endl;
}
