#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int N = 1e3 + 5;
int s[10], a[10];
long long f[N], ans;
void dfs(int i) {
  if (i == 10) {
    int s = 0;
    for (int j = 0; j < 10; j++) s += a[j];
    long long t = f[s];
    for (int j = 0; j < 10; j++)
      if (a[j]) t /= f[a[j]];
    if (a[0]) t = t - t * a[0] / s;
    ans += t;
    assert(ans >= 0);
    return;
  }
  if (s[i] == 0) dfs(i + 1);
  for (int j = 1; j <= s[i]; j++) {
    a[i] = j;
    dfs(i + 1);
  }
}
int main() {
  f[0] = 1;
  for (int i = 1; i <= 20; i++) f[i] = f[i - 1] * i;
  long long n;
  cin >> n;
  while (n) {
    s[n % 10]++;
    n /= 10;
  }
  dfs(0);
  cout << ans << endl;
  return 0;
}
