The number of derangements for $n$ objects is given by the recursive relation:
$$!n = (n-1) (!(n-1) + !(n-2))$$
This can be easily proved (for example, see the argument on Wikipedia page). Before looking at this argument, I thought along these lines: suppose we know $!(n-1)$, then I can create a derangement for $n$ objects by first taking a derangement for $n-1$ objects, placing $n$'th object at place $n$, and then swapping it with one of first $n-1$ objects. This would give us: $$!n = (n-1) (!(n-1))$$
But this number is less than the actual number given above. I was wondering what is wrong with this argument and which derangements it misses.
Let $\pi$ be a derangement of $\{1,2,\dots,n\}$. Suppose that $\pi(n)=j$ and $\pi(i)=n$. Then $i,j\in\{1,2,\dots,n-1\}$. Swapping values $j$ and $n$ in $\pi$ yields a permutation $\pi'$ such that $\pi'(n)=n$, $\pi'(i)=j$ and $\pi'(k)=\pi(k)\ne k$ for all $k\ne i,n$. This permutation has exactly $1$ fixed point if $i\ne j$, and exactly $2$ fixed points if $i=j$. Deleting those fixed points, you obtain either $!(n-1)$ or $!(n-2)$ permutations. There are $n-1$ choices for $j$, hence the recursive relation you stated at the beginning.