#include <bits/stdc++.h>
using namespace std;
long long C(int n, int k) {
  if (!k || n == k) {
    return 1;
  }
  long long ans = 1;
  int limit = max(n - k + 1, k + 1);
  for (int i = limit; i <= n; i++) {
    ans *= i;
  }
  limit = min(k, n - k);
  for (int i = limit; i > 1; i--) {
    ans /= i;
  }
  return ans;
}
class Sol {
 public:
  void dfs(int index) {
    if (index == count.size()) {
      long long temp = 1;
      int remain = digits;
      for (int i = 0; i < 10; i++) {
        if (!cur[i]) continue;
        if (!i) {
          temp *= C(remain - 1, cur[i]);
        } else
          temp *= C(remain, cur[i]);
        remain -= cur[i];
      }
      ans += temp;
      return;
    }
    if (!count[index]) {
      cur.push_back(0);
      dfs(index + 1);
      cur.pop_back();
    } else {
      for (int i = 1; i <= count[index]; i++) {
        cur.push_back(i);
        digits += i;
        dfs(index + 1);
        digits -= i;
        cur.pop_back();
      }
    }
  }
  long long solve(long long n) {
    count.assign(10, 0);
    while (n) {
      count[n % 10]++;
      n /= 10;
    }
    dfs(0);
    return ans;
  }
  vector<int> count;
  vector<int> cur;
  int digits = 0;
  long long ans = 0;
};
int main() {
  Sol s;
  long long n;
  cin >> n;
  cout << s.solve(n) << endl;
}
