#include <bits/stdc++.h>
using namespace std;
long long n;
int a[10];
int b[10];
long long fact[20];
long long ans = 0;
long long pan(int y) {
  long long res = fact[y] * (y - b[0]) / y;
  for (int i = 0; i < 10; ++i) res /= fact[b[i]];
  return res;
}
void Solve(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;
        Solve(x + 1, y + i);
      }
    else {
      b[x] = 0;
      Solve(x + 1, y);
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  while (n) {
    ++a[n % 10];
    n /= 10;
  }
  fact[0] = 1;
  for (int i = 1; i <= 19; ++i) fact[i] = fact[i - 1] * i;
  Solve(0, 0);
  cout << ans << endl;
}
