#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
long long fact[20];
string str;
int n;
long long getAns() {
  map<vector<int>, bool> taken;
  long long ans = 0LL;
  int minCnt = 0;
  bool exists[10] = {};
  for (long long i = 0; i < (n); ++i)
    if (!exists[str[i] - 48]) {
      exists[str[i] - 48] = true;
      ++minCnt;
    }
  for (long long i = 0; i < ((1 << n)); ++i) {
    vector<int> cnt(10);
    int curCnt = 0;
    int tempN = 0;
    for (long long j = 0; j < (n); ++j)
      if (i & (1 << j)) ++cnt[str[j] - 48];
    for (long long i = 0; i < (10); ++i)
      if (cnt[i]) {
        tempN += cnt[i];
        ++curCnt;
      }
    if (curCnt != minCnt) continue;
    if (!taken[cnt]) {
      taken[cnt] = true;
      long long temp = fact[tempN];
      for (long long i = 0; i < (10); ++i) temp /= fact[cnt[i]];
      if (cnt[0]) {
        long long diff = fact[tempN - 1];
        --cnt[0];
        for (long long i = 0; i < (10); ++i) diff /= fact[cnt[i]];
        temp -= diff;
      }
      ans += temp;
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> str;
  n = str.length();
  fact[0] = 1LL;
  for (long long i = (1); i < (20); ++i) fact[i] = fact[i - 1] * i;
  cout << getAns() << '\n';
  return 0;
}
