# How many numbers from given set of digits?

Given $n$ digits $x_1,...,x_n.$ I would like to understand how many $n$-digit numbers I can form from this set of digits.

I would like to emphasize that I can pick each digit only once, so $x_1 x_1 ... x_1$ is not allowed.

But if $x_1$ and $x_2$ are the same digit, then of course both $x_1$ and $x_2$ must appear in the number.

A simple example

Let $x_1=1$ and $x_2=2$ then $12$ and $21$ are the only numbers.

However, if $x_1=x_2=1$ then $11$ is the only number.

Is there a general formula for the number of numbers for a given set of digits?

So for an example without zeroes, arranging the digits "$111255668889$" has $\binom{12}{3,1,2,2,3,1} = \binom{12}{3,3,2,2,1,1}$ $= \frac{12!}{3!3!2!2!}$ $= 3326400$ options