We want to count the number of ways of arranging $n$ objects in order.
By the fundamental principle of counting, there
are $n$ ways to select the first card, $n-1$
ways to select the second, and so on.
Thus, the number of ways of stacking $n$ cards
in a deck is
\[
n(n-1)(n-2)\cdots1
\]
Factorial function. Define $f: \N \to \N $ recursively by $f(1) = 1$ and $f(2) = 2f(1)$, and $f(n) = nf(n-1)$ for $n \in \N $ ($f$ exists by the the recursion theorem—see Recursion Theorem). $f$ is defined such that $f(n)$ is $n$ factorial, for which reason we call $f$ the factorial function. For convenience, we extend $f$ to $\omega $1 by defining $f(0) = 1$.
We denote the factorial of $n$ by $n!$, read aloud “n factorial”. So for example, $5! = 5\cdot 4\cdot 3\cdot 2\cdot 1$ and $0! = 1$.