#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int freq[10];
set<vector<int> > vis;
long long n, ans, f[20];
long long calc() {
  long long s = accumulate(v.begin(), v.end(), 0), res = 0;
  res = f[s];
  for (auto i : v) res /= f[i];
  return res;
}
void solve() {
  if (vis.count(v)) return;
  vis.insert(v);
  ans += calc();
  if (v[0]) {
    v[0]--;
    ans -= calc();
    v[0]++;
  }
  for (int i = 0; i < 10; i++) {
    if (freq[i] > 0) {
      v[i]++, freq[i]--;
      solve();
      v[i]--, freq[i]++;
    }
  }
}
int main() {
  f[0] = f[1] = 1;
  for (int i = 2; i < 20; i++) f[i] = i * f[i - 1];
  cin >> n;
  while (n) freq[n % 10]++, n /= 10;
  for (int i = 0; i < 10; i++) {
    v.push_back((freq[i] > 0));
    freq[i] -= v[i];
  }
  solve();
  cout << ans << endl;
  return 0;
}
