#include <bits/stdc++.h>
using namespace std;
long long n, ans, a[20], b[20], f[20];
long long pan(long long x) {
  long long sum = x - b[0];
  for (int i = 1; i <= x - 1; i++) sum *= i;
  for (int i = 0; i <= 9; i++) {
    sum /= f[b[i]];
  }
  return sum;
}
void s(int x, int y) {
  if (x == 10) {
    ans += pan(y);
  } else if (a[x]) {
    for (int i = 1; i <= a[x]; i++) {
      b[x] = i;
      s(x + 1, y + i);
    }
  } else
    s(x + 1, y);
}
int main() {
  scanf("%lld", &n);
  f[0] = 1;
  f[1] = 1;
  for (int i = 2; i <= 18; i++) f[i] = f[i - 1] * i;
  while (n > 0) {
    a[n % 10]++;
    n /= 10;
  }
  s(0, 0);
  printf("%lld", ans);
}
