#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  ll n;
  cin >> n;
  int T[10];
  for (int i = 0; i < 10; ++i) T[i] = 1;
  int len = 2;
  while (n > 0) {
    len++;
    T[n % 10]++;
    n /= 10;
  }
  ll dp[len][11];
  ll takes[len + 1][len + 1];
  for (int i = 0; i < len; ++i) takes[i][0] = takes[i][i] = 1;
  for (int i = 2; i < len; ++i)
    for (int j = 1; j < i; ++j)
      takes[i][j] = takes[i - 1][j] + takes[i - 1][j - 1];
  int alr = 0;
  for (int i = 0; i < len; ++i) dp[i][0] = (i == 0);
  for (int i = 1; i < 10; ++i) {
    if (T[i] == 1) {
      for (int j = 0; j < len; ++j) dp[j][i] = dp[j][i - 1];
    } else {
      for (int j = 0; j < len; ++j) dp[j][i] = 0;
      for (int j = 1; j < T[i]; ++j) {
        for (int k = alr + j; k < len; ++k) {
          dp[k][i] += dp[k - j][i - 1] * takes[k][j];
        }
      }
      alr++;
    }
  }
  int idx = 9;
  if (T[0] > 1) {
    idx = 10;
    for (int j = 0; j < len; ++j) dp[j][10] = 0;
    for (int j = 1; j < T[0]; ++j) {
      for (int k = alr + j; k < len; ++k) {
        dp[k][10] += dp[k - j][9] * takes[k - 1][j];
      }
    }
  }
  ll ans = 0;
  for (int i = 0; i < len; ++i) ans += dp[i][idx];
  cout << ans;
}
