#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const long long int inf64 = 1e18 + 5;
const int N = 19;
long long int fac[N];
long long int ans;
void rec(int x, vector<int> &tot, vector<int> v) {
  if (x == 10) {
    int z = 0, nz = 0;
    for (int i = 0; i < 10; i++) {
      if (i == 0)
        z += v[i];
      else
        nz += v[i];
    }
    long long int res = 1ll * nz * fac[nz - 1 + z];
    for (int i = 0; i < 10; i++) res /= fac[v[i]];
    ans += res;
    return;
  }
  if (!tot[x]) rec(x + 1, tot, v);
  for (int i = 1; i <= tot[x]; i++) {
    v[x] = i;
    rec(x + 1, tot, v);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int n;
  cin >> n;
  vector<int> tot(10, 0), v(10, 0);
  while (n) {
    tot[n % 10]++;
    n /= 10;
  }
  fac[0] = 1;
  for (int i = 1; i < N; i++) fac[i] = fac[i - 1] * i;
  ans = 0;
  rec(0, tot, v);
  cout << ans;
}
