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?