#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e18;
const long double PI = 4 * atan((long double)1);
const int INFTY = 1e7;
int freq[10];
int cnt[10];
int delta[10];
long long fact[20];
long long C[30][30];
long long ans;
void process(int digits) {
  int res[10];
  for (int i = 0; i <= 9; ++i) {
    res[i] = cnt[i] + delta[i];
  }
  long long second = 0;
  for (int i = 1; i <= 9; ++i) {
    second += res[i];
  }
  long long tmp = fact[second];
  for (int i = 1; i <= 9; ++i) {
    assert(fact[res[i]] != 0);
    tmp /= fact[res[i]];
  }
  digits -= res[0];
  ans += tmp * C[digits + res[0] - 1][digits - 1];
}
void weak_compositions(int digits, int n, int idx = 0) {
  if (idx == 10) {
    if (n == 0) {
      process(digits);
    }
    return;
  }
  int bd = freq[idx];
  for (int i = 0; i <= bd; ++i) {
    int left = n - i;
    if (left >= 0) {
      delta[idx] = i;
      weak_compositions(digits, left, idx + 1);
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  C[0][0] = 1;
  for (int i = 1; i <= 25; ++i) {
    for (int j = 0; j <= i; ++j) {
      if (j == 0) {
        C[i][j] = 1;
        continue;
      } else if (j == 1) {
        C[i][j] = i;
        continue;
      }
      C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
    }
  }
  string second;
  cin >> second;
  int distinct = 0;
  for (int i = 0; i < (int)second.size(); ++i) {
    freq[second[i] - '0']++;
    distinct += (freq[second[i] - '0'] == 1);
  }
  for (int i = 0; i <= 9; ++i) {
    cnt[i] = freq[i] > 0;
    if (freq[i] > 0) freq[i]--;
  }
  long long bd = second.size() - distinct;
  fact[0] = fact[1] = 1;
  for (int k = 2; k <= 19; ++k) fact[k] = 1ll * fact[k - 1] * k;
  for (int i = 0; i <= bd; ++i) {
    weak_compositions(i + distinct, i);
  }
  cout << ans << endl;
}
