#include <bits/stdc++.h>
using namespace std;
string s;
int n;
long long ans = 0, fact[20];
bool have[10];
unordered_map<string, bool> vis;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  fact[0] = 1;
  for (int i = 1; i < 20; i++) fact[i] = fact[i - 1] * i;
  cin >> s;
  n = (int)s.size();
  for (auto c : s) have[c - '0'] = true;
  for (int i = 1; i < (1 << n); i++) {
    string now;
    for (int j = 0; j < n; j++)
      if (i & (1 << j)) now += s[j];
    sort(now.begin(), now.end());
    if (vis[now]) continue;
    vis[now] = true;
    int chave[10];
    for (int j = 0; j < 10; j++) chave[j] = 0;
    for (auto c : now) chave[c - '0']++;
    bool check = true;
    for (int j = 0; j < 10; j++)
      if (have[j] && chave[j] == 0) check = false;
    if (!check) continue;
    long long add = fact[(int)now.size()];
    for (int j = 0; j < 10; j++) add /= fact[chave[j]];
    if (chave[0] != 0) {
      long long subtr = fact[(int)now.size() - 1];
      subtr /= fact[chave[0] - 1];
      for (int j = 1; j < 10; j++) subtr /= fact[chave[j]];
      add -= subtr;
    }
    ans += add;
  }
  cout << ans << "\n";
  return 0;
}
