#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 10, Mod = 1e9 + 7;
long long q, r, t, a, b, tot, d, C[20], D[30][30];
vector<long long> A, B;
void get(long long l = 0, long long w = 0) {
  long long ret = 0;
  if (l == A.size()) {
    long long s = 0, c = 1;
    for (auto X : B) s += X;
    for (auto X : B) c *= D[X][s], s -= X;
    tot += c;
    return;
  }
  long long tt = 1;
  if (l == 0 && w == 1) tt = 0;
  for (long long i = tt; i <= A[l]; i++) {
    B.push_back(i);
    get(l + 1);
    B.pop_back();
  }
}
long long Solve(long long n) {
  long long C[10], _n = n;
  memset(C, 0, sizeof(C));
  A.clear();
  while (_n) C[_n % 10]++, _n /= 10;
  for (long long i = 0; i <= 9; i++)
    if (C[i]) A.push_back(C[i]);
  get();
  long long ret = tot;
  tot = 0;
  if (!C[0]) return (ret);
  C[0]--;
  A.clear();
  A.push_back(C[0]);
  for (long long i = 1; i <= 9; i++)
    if (C[i]) A.push_back(C[i]);
  get(0, 1);
  ret -= tot;
  tot = 0;
  return (ret);
}
int32_t main() {
  long long n;
  for (long long i = 0; i < 20; i++) D[0][i] = D[i][i] = 1;
  for (long long i = 0; i < 20; i++)
    for (long long j = 1; j < i; j++) D[j][i] = (D[j][i - 1] + D[j - 1][i - 1]);
  scanf("%lld", &n);
  printf("%lld\n", Solve(n));
  return (0);
}
