#include <bits/stdc++.h>
using namespace std;
bool vowel(char a) {
  a = toupper(a);
  if ((a == 'A') || (a == 'E') || (a == 'I') || (a == 'O') || (a == 'U'))
    return 1;
  return 0;
}
long long int n, m, q, a, b, c, sum = 0, cnt = 0;
long long int arr[1000055];
map<long long int, bool> mp;
string s;
vector<int> v;
long long int F[20];
void fact() {
  F[0] = 1;
  F[1] = 1;
  for (long long int i = 2; i <= 18; i++) F[i] = F[i - 1] * i;
}
void dfs(long long int tot, long long int dg, long long int und,
         long long int z) {
  if (dg == 10) {
    if (z) {
      long long int up = F[tot - 1] * (tot - z);
      sum += up / und;
    } else {
      long long int up = F[tot];
      sum += up / und;
    }
    return;
  }
  for (int i = 1; i <= arr[dg]; i++) {
    dfs(tot + i, dg + 1, und * F[i], z);
  }
  if (arr[dg] == 0) {
    dfs(tot, dg + 1, und, z);
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  fact();
  cin >> s;
  for (int i = 0; i < s.size(); i++) arr[s[i] - '0']++;
  for (int i = 1; i <= arr[0]; i++) {
    dfs(i, 1, F[i], i);
  }
  if (arr[0] == 0) {
    dfs(0, 1, 1, 0);
  }
  cout << sum << endl;
}
