#include <bits/stdc++.h>
using namespace std;
const int N = 25;
long long num[N], num_tmp[N], jc[N], ans, len;
string s;
void d(long long k);
int main() {
  cin >> s;
  len = s.size();
  for (int i = 0; i < len; i++) {
    num[s[i] - '0']++;
  }
  jc[0] = 1;
  for (int i = 1; i <= 19; i++) {
    jc[i] = jc[i - 1] * i;
  }
  d(0);
  printf("%lld", ans);
  return 0;
}
void d(long long k) {
  if (k == 10) {
    long long cnt = 0;
    for (int i = 0; i < 10; i++) {
      cnt += num_tmp[i];
    }
    long long tmp = jc[cnt];
    for (int i = 0; i < 10; i++) {
      tmp /= jc[num_tmp[i]];
    }
    if (num_tmp[0] >= 1) {
      tmp -= (tmp * num_tmp[0] / cnt);
    }
    ans += tmp;
    return;
  }
  for (int i = 1; i <= num[k]; i++) {
    num_tmp[k] = i;
    d(k + 1);
  }
  if (num[k] == 0) {
    d(k + 1);
  }
}
