#include <bits/stdc++.h>
using namespace std;
long long a[10];
long long ans = 0;
void DFS(long long n, long long u, long long r[10]) {
  if (n == 10) {
    long long sum = 1;
    for (long long i = 2; i <= u; i++) sum *= i;
    for (long long i = 1; i < 10; i++)
      for (long long j = 2; j <= r[i]; j++) sum /= j;
    long long b = 0;
    for (long long i = 1; i <= a[0]; i++) {
      long long d = 1, f = 1;
      for (long long j = 0; j < i; j++) {
        d *= u + j;
        f *= j + 1;
      }
      b += d / f;
    }
    if (a[0] == 0) b = 1;
    ans += b * sum;
    return;
  }
  if (a[n] == 0) {
    r[n] = 0;
    DFS(n + 1, u, r);
    return;
  }
  for (long long i = 1; i <= a[n]; i++) {
    r[n] = i;
    DFS(n + 1, u + i, r);
  }
}
int main() {
  long long d[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  long long s;
  cin >> s;
  while (s) {
    a[s % 10]++;
    s /= 10;
  }
  DFS(1, 0, d);
  cout << ans << endl;
  return 0;
}
