#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000000000000LL;
const long long NMAX = 1e6 + 4;
const long long mod = 1e9 + 7;
const double eps = 1e-10;
const double PI = acos(-1);
long long dp[400000];
vector<long long> goal;
vector<long long> curr;
long long f() {
  long long idx = 0;
  long long prod = 1;
  for (long long i = 0; i < 10; i++) {
    idx += prod * curr[i];
    prod *= goal[i] + 1;
  }
  long long &res = dp[idx];
  if (res != -1) return res;
  res = 1;
  for (long long i = 0; i < 10; i++)
    if (goal[i] > 0 and curr[i] == 0) res = 0;
  for (long long i = 0; i < 10; i++) {
    if (curr[i] < goal[i]) {
      curr[i]++;
      res += f();
      curr[i]--;
    }
  }
  return res;
}
signed main() {
  ios::sync_with_stdio(false);
  for (long long i = 0; i < 400000; i++) dp[i] = -1;
  long long n;
  cin >> n;
  goal.assign(10, 0);
  curr.assign(10, 0);
  while (n) {
    goal[n % 10]++;
    n /= 10;
  }
  long long sum = 0;
  for (long long i = 1; i < 10; i++)
    if (goal[i] > 0) {
      curr[i]++;
      sum += f();
      curr[i]--;
    }
  cout << sum << endl;
}
