The number of functions $ f : \left \{ 1, 2, . . . , 10 \right \} \rightarrow \left \{ 1, 2, . . . , 10 \right \}$ such that $f(x) \neq x$ for all $x$ Question

The number of functions $ f : \left \{ 1, 2, . . . , 10 \right \} \rightarrow \left \{ 1, 2, . . . , 10 \right \}$ such that $f(x) \neq   x$ for all $x$ is

Approach
Total number of function possible $=10^{10}$
But with the restriction ,$f(x) \neq   x$ for all $x$,
Eg-:$f(1)\neq 1 $ each element in the domain will have 1 less available option in the range .
So total number of function possible$=9^{10}$
Am I correct?
please help.

Case 1: If functions are not bijective. 
It's a simple case for every $i^{th}$ element ,$1\le i\le 10$, you have 9 possibilities to choose from for the output.  
Hence total number of functions=$ 9^{10}$
Case 2: If functions are bijective 
On close observation you might notice that what you need is exactly the number of Derangements that could be done with $10$ elements. That means you need to find $$!10=\left\lfloor \frac {9!}{e}+\frac 12\right\rfloor =362 880    $$
