How many functions $f : \{0,1,2,3\}^n \to \{1,2,3\}$ are there, that take the value $1$ exactly once? 
How many functions $f : \{0,1,2,3\}^n \to \{1,2,3\}$ are there, that take the value $1$ exactly once?

I know the answer to this question is $4^n \cdot 2^{4^n-1}$ but I don´t understand at all how to arrive at this result. 
 A: Note that $A := \{0,1,2,3\}^n$ has $4^n$ elements and $B := \{1,2,3\}$ has $2$ elements besides the 1. To give a function that takes $1$ exactly ones we first choose an element $a \in A$ which is mapped to $1$, there are $4^n$ possiblities for that, and after that, we have to choose images for the remaining $4^n - 1$ elements of $A \setminus \{a\}$, for each we have 2 choices, giving $2^{4^n - 1}$ possibilites for that part. Alltogether, we have $4^n \cdot 2^{4^n - 1}$. 
A: You choose which point $P$ of the domain is mapped into $1$ (you have $4^n$ choices), then you choose a function from $\{0,1,2,3\}^n\setminus\{P\}$ to $\{2,3\}$ (you have $2^{4^n-1}$ choices).
A: In stead of $\{0,1,2,3\}^n$ let the domain of $f$ be a finite set $A$ with cardinality $m$.
Exactly one element $a\in A$ must be selected to be sent to $1$. 
There are $m$ choices for $a$. 
For every element $b\in A-\{a\}$ there are $2$ choices for $f(b)$, resulting in $2^{m-1}$ possibilities in total.
Final answer:$$m\times2^{m-1}$$
If $A=\{0,1,2,3\}^n$ then $m=4^n$.
