#include <bits/stdc++.h>
using namespace std;
inline void prep() {
  cin.tie(0);
  cin.sync_with_stdio(0);
};
const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 20;
vector<int> cnt(10, 0);
long long calc(vector<int>& cur) {
  int n = 0;
  for (int d = 0; d < 10; ++d) {
    n += cur[d];
  }
  long long fact = 1;
  for (int x = 2; x <= n; ++x) fact = fact * x;
  for (int d = 0; d < 10; ++d) {
    long long ff = 1;
    for (int z = 2; z <= cur[d]; ++z) ff = ff * z;
    fact /= ff;
  }
  return fact;
}
long long go(int i, vector<int>& cur) {
  if (i == 10) {
    long long res = calc(cur);
    if (cur[0]) {
      cur[0]--;
      long long del = calc(cur);
      res -= del;
      cur[0]++;
    }
    return res;
  }
  long long res = cnt[i] == 0 ? go(i + 1, cur) : 0;
  for (int take = 1; take <= cnt[i]; ++take) {
    cur[i] += take;
    res += go(i + 1, cur);
    cur[i] -= take;
  }
  return res;
}
int main() {
  prep();
  string s;
  cin >> s;
  int n = s.size();
  for (int i = 0; i < n; ++i) {
    cnt[s[i] - '0']++;
  }
  vector<int> v(10);
  long long res = go(0, v);
  cout << res << endl;
  return 0;
}
