#include <bits/stdc++.h>
using namespace std;
set<int> digits;
char str[20];
int used[10], n;
long long fact[20];
pair<long long, bool> valid() {
  long long mult = 1;
  bool ok = true;
  for (int x : digits) {
    if (!used[x])
      ok = false;
    else
      mult *= fact[used[x]];
  }
  return {mult, ok};
}
void start() {
  scanf("%s", str);
  n = strlen(str);
  sort(str, str + n);
  reverse(str, str + n);
  fact[0] = 1;
  for (int i = 1; i < 20; i++) {
    fact[i] = fact[i - 1] * i;
  }
  for (int i = 0; i < n; i++) {
    digits.emplace(str[i] - '0');
  }
}
int main() {
  start();
  long long ans = 0;
  unordered_set<long long> seen;
  for (int mask = (1 << n) - 1; mask > 0; mask--) {
    long long key = 0;
    int sz = 0;
    for (int x : digits) {
      used[x] = 0;
    }
    for (int i = n - 1; i >= 0; i--) {
      if (mask & (1 << i)) {
        int x = str[i] - '0';
        key = key * 11 + x + 1;
        used[x]++;
        sz++;
      }
    }
    auto V = valid();
    if (V.second && (seen.find(key) == seen.end())) {
      seen.emplace(key);
      ans += fact[sz] / V.first;
      if (used[0]) {
        used[0]--;
        V = valid();
        ans -= fact[sz - 1] / V.first;
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}
