#include <bits/stdc++.h>
int main(int argc, char** argv) {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);
  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);
  std::string s;
  std::cin >> s;
  std::map<int, int> map;
  map[0] = 0;
  for (const auto& c : s) map[c - '0']++;
  long long c = 0;
  std::map<std::vector<int>, long long> curr;
  std::vector<int> a(10);
  for (int i = 0; i < 10; i++) a[i] = map[i];
  curr[a] = 1;
  for (int i = 0; i <= s.size(); i++) {
    std::map<std::vector<int>, long long> next;
    for (const auto& kv : curr) {
      bool valid = true;
      for (int j = 0; j < 10; j++)
        if (map[j] && kv.first[j] == map[j]) {
          valid = false;
          break;
        }
      if (valid) c += kv.second;
      for (int j = i == 0 ? 1 : 0; j < 10; j++)
        if (kv.first[j]) {
          std::vector<int> key(kv.first);
          key[j]--;
          next[key] += kv.second;
        }
    }
    curr = std::move(next);
  }
  std::cout << c << std::endl;
  return 0;
}
