#include <bits/stdc++.h>
using namespace std;
long long a;
int vis[20], shu[20];
long long ans, jc[20];
void dfs(int x) {
  if (x >= 10) {
    int cnt = 0;
    for (int i = 0; i <= 9; i++) {
      cnt += shu[i];
    }
    long long p = jc[cnt];
    for (int i = 0; i <= 9; i++) {
      p /= jc[shu[i]];
    }
    if (shu[0] >= 1) p -= (p * shu[0] / cnt);
    ans += p;
    return;
  }
  for (int i = 1; i <= vis[x]; i++) {
    shu[x] = i;
    dfs(x + 1);
  }
  if (vis[x] == 0) {
    dfs(x + 1);
  }
}
int main() {
  scanf("%lld", &a);
  while (a) {
    vis[a % 10]++;
    a /= 10;
  }
  jc[0] = 1;
  for (int i = 1; i <= 19; i++) {
    jc[i] = jc[i - 1] * i;
  }
  dfs(0);
  printf("%lld", ans);
  return 0;
}
