#include <bits/stdc++.h>
using namespace std;
void desperate_optimization(int precision) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
  cout.precision(precision);
}
int ctr[10];
long long dp[10][25];
long long combin[25][25];
int main() {
  desperate_optimization(10);
  for (int i = 0; i <= 20; i++) {
    for (int j = 0; j <= 20; j++) {
      if (j == 0 || j == i)
        combin[i][j] = 1;
      else
        combin[i][j] = combin[i - 1][j] + combin[i - 1][j - 1];
    }
  }
  long long x;
  cin >> x;
  int maxi = 0;
  while (x) {
    ctr[x % 10]++;
    maxi = max(maxi, (int)(x % 10));
    x /= 10;
  }
  int sum = ctr[0];
  int first = 0;
  int pertamax = 0;
  for (int i = 0; i <= ctr[0]; i++) dp[0][i] = 1;
  if (ctr[0] != 0) pertamax = 1;
  for (int i = 1; i <= maxi; i++) {
    dp[i][0] = 0;
    if (ctr[i] == 0) continue;
    for (int j = 1; j <= sum + ctr[i]; j++) {
      for (int k = 1; k <= min(ctr[i], j); k++) {
        int sisa = j - k;
        if (sisa == 0 && pertamax == 1) break;
        dp[i][j] = dp[i][j] + dp[first][j - k] * combin[j][k];
      }
    }
    pertamax = 1;
    first = i;
    sum += ctr[i];
  }
  long long res = 0;
  for (int j = 1; j <= 20; j++) {
    res += dp[first][j];
  }
  memset(dp, 0, sizeof(dp));
  long long red = 0;
  if (ctr[0] != 0) {
    ctr[0]--;
    int sum = ctr[0];
    int first = 0;
    int pertamax = 0;
    for (int i = 0; i <= ctr[0]; i++) dp[0][i] = 1;
    for (int i = 1; i <= maxi; i++) {
      dp[i][0] = 1;
      if (ctr[i] == 0) continue;
      for (int j = 1; j <= sum + ctr[i]; j++) {
        for (int k = 1; k <= min(ctr[i], j); k++) {
          int sisa = j - k;
          if (sisa == 0 && pertamax == 1) break;
          dp[i][j] = dp[i][j] + dp[first][j - k] * combin[j][k];
        }
      }
      pertamax = 1;
      first = i;
      sum += ctr[i];
    }
    for (int j = 1; j <= 20; j++) {
      red += dp[first][j];
    }
  }
  cout << res - red << '\n';
  return 0;
}
