#include <bits/stdc++.h>
using namespace std;
const int sz = 1e5 + 5;
long long ans, d[10], fac[20], a[10];
void go(int i) {
  if (i == 10) {
    int n = 0;
    for (int j = 0; j < 10; j++) n += a[j];
    long long now = fac[n];
    for (int j = 0; j < 10; j++) now /= fac[a[j]];
    ans += now;
    if (!a[0]) return;
    now = fac[n - 1];
    a[0]--;
    for (int j = 0; j < 10; j++) now /= fac[a[j]];
    a[0]++;
    ans -= now;
    return;
  }
  if (!d[i]) go(i + 1);
  for (int j = 1; j <= d[i]; j++) {
    a[i] = j;
    go(i + 1);
  }
}
int main() {
  fac[0] = 1;
  for (int i = 1; i < 20; i++) fac[i] = fac[i - 1] * i;
  long long n;
  cin >> n;
  while (n) d[n % 10]++, n /= 10;
  go(0);
  cout << ans;
}
