#include <bits/stdc++.h>
using namespace std;
int cnt[10], k;
long long fac[20], ans = 0;
void fun(int pos, vector<int> v) {
  if (pos == 10) {
    long long ret = 0;
    int tot = 0;
    for (int i = 0; i < v.size(); i++) tot += v[i];
    ret = fac[tot];
    for (int i = 0; i < v.size(); i++) ret /= fac[v[i]];
    if (v[0] > 0) {
      long long temp = fac[tot - 1];
      temp /= fac[v[0] - 1];
      for (int i = 1; i < v.size(); i++) temp /= fac[v[i]];
      ret -= temp;
    }
    ans += ret;
    return;
  }
  if (cnt[pos] == 0) {
    vector<int> u = v;
    u.push_back(0);
    fun(pos + 1, u);
  } else {
    for (int i = 1; i <= cnt[pos]; i++) {
      vector<int> u = v;
      u.push_back(i);
      fun(pos + 1, u);
    }
  }
}
int main() {
  fac[0] = 1;
  for (long long i = 1; i <= 20; i++) fac[i] = fac[i - 1] * i;
  long long n;
  cin >> n;
  while (n != 0) {
    int r = n % 10LL;
    cnt[r]++;
    n /= 10LL;
  }
  ans = 0;
  vector<int> v;
  fun(0, v);
  cout << ans << endl;
  return 0;
}
