#include <bits/stdc++.h>
using namespace std;
long long fat[30];
vector<long long> cnt(10);
map<vector<long long>, bool> vis;
long long calc(vector<long long> cnt) {
  long long ans = 0;
  for (long long i = 1; i < 10; i++) {
    if (cnt[i] == 0) continue;
    bool eita = false;
    cnt[i]--;
    long long sz = 0;
    for (long long j = 0; j < 10; j++) sz += cnt[j];
    long long cur = fat[sz];
    for (long long j = 0; j < 10; j++) cur /= fat[cnt[j]];
    cnt[i]++;
    ans += cur;
  }
  return ans;
}
long long solve(vector<long long> cnt) {
  vis[cnt] = true;
  long long ans = calc(cnt);
  vector<long long> cnt2 = cnt;
  for (long long i = 0; i < 10; i++) {
    if (cnt2[i] <= 1) continue;
    cnt2[i]--;
    if (!vis[cnt2]) ans += solve(cnt2);
    cnt2[i]++;
  }
  return ans;
}
int32_t main() {
  string s;
  for (long long i = 0; i < 10; i++) cnt[i] = 0;
  fat[0] = 1;
  for (long long i = 1; i < 29; i++) fat[i] = fat[i - 1] * i;
  cin >> s;
  for (char c : s) {
    cnt[c - '0']++;
  }
  cout << solve(cnt) << endl;
}
