import std.algorithm;
import std.array;
import std.bitmanip;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
    auto n = readln.chomp;
    
    int[10] cnt;
    
    foreach (i, ref e; cnt) {
        e = cast(int) n.count!(c => c - '0' == i);
    }
    
    debug { writeln(cnt); }
    
    long[20][20] binom;
    binom[0][0] = 1;
    foreach (i; 1..20) {
        foreach (j; 0..20) {
            binom[i][j] = binom[i-1][j] + (j > 0 ? binom[i-1][j-1] : 0);
        }
    }
    
    debug { binom.each!writeln; }
    
    bool next_variant(ref int[10] lim) {
        foreach_reverse (i; 0..10) {
            if (cnt[i] == 0) continue;
            
            if (lim[i] < cnt[i]) {
                ++lim[i];
                return true;
            } else {
                lim[i] = 1;
            }
        }
        return false;
    }
    
    int[10] lim;
    foreach (i; 0..10) if (cnt[i] > 0) lim[i] = 1;
    
    long ans = 0;
    do {    
        int left = sum(lim[0..$]);
        
        long cur = binom[left - 1][lim[0]];
        left -= lim[0];
        foreach (e; lim[1..10]) {
            cur *= binom[left][e];
            left -= e;
        }
        ans += cur;
    } while (next_variant(lim));
    
    ans.writeln;
}