#include <bits/stdc++.h>
using namespace std;
long long fac[20];
set<char> s;
set<string> ss;
long long countVariants(unordered_map<char, int> &dgts) {
  int len = 0;
  for (char c = '0'; c <= '9'; c++) {
    len += dgts[c];
  }
  long long cnt = fac[len];
  for (auto it = dgts.begin(); it != dgts.end(); it++) {
    char c = it->first;
    cnt /= fac[dgts[c]];
  }
  return cnt;
}
long long getVariants(string &m) {
  sort(m.begin(), m.end());
  if (ss.count(m)) {
    return 0;
  }
  ss.insert(m);
  unordered_map<char, int> dgts(10);
  for (char c : m) {
    dgts[c]++;
  }
  for (char c = '0'; c <= '9'; c++) {
    if (s.count(c) && dgts[c] == 0) {
      return 0;
    }
  }
  long long cnt = countVariants(dgts);
  if (dgts['0'] > 0) {
    dgts['0']--;
    cnt -= countVariants(dgts);
  }
  return cnt;
}
int main() {
  fac[0] = 1;
  for (int i = 1; i < 20; i++) {
    fac[i] = i * fac[i - 1];
  }
  string n;
  cin >> n;
  for (char c : n) {
    s.insert(c);
  }
  long long cnt = 0;
  int k = n.size();
  for (int i = 1; i <= (1 << k); i++) {
    string m;
    for (int j = 0; j < k; j++) {
      if (i & (1 << j)) {
        m += n[j];
      }
    }
    cnt += getVariants(m);
  }
  cout << cnt << endl;
  return 0;
}
