#include <bits/stdc++.h>
using namespace std;
long long f[20];
int a[10] = {0};
long long ans = 0;
int ff(int k, int j, long long s, int l) {
  if (k > 9) {
    ans += f[j] / s;
    return 0;
  }
  if (a[k] == 0 && k != l)
    ff(k + 1, j, s, l);
  else
    for (int i = 1 - (k == l); i <= a[k]; i++) {
      s *= f[i];
      j = j + i;
      ff(k + 1, j, s, l);
      s = s / f[i];
      j = j - i;
    }
  return 0;
}
int main() {
  long long n;
  cin >> n;
  long long i, j, k;
  f[0] = 1;
  for (i = 1; i < 19; i++) {
    f[i] = f[i - 1] * i;
  }
  j = n;
  while (j != 0) {
    a[j % 10]++;
    j = j / 10;
  }
  for (i = 1; i < 10; i++) {
    if (a[i] == 0) continue;
    a[i]--;
    ff(0, 0, 1, i);
    a[i]++;
  }
  cout << ans;
}
