Determine the number of elements $f$ of $S_n$ for which $f(1) \ne 1$ and $f(2) \ne 2$.

Normally $S_n$ denotes the set of permutations of $\{1,2,\ldots,n\}$, that is the bijections from the set to itself. I'll assume you mean $S_n$ in the remainder of your question. If you really mean $F_n$ you will have to amend the argument appropriately.

Better to let $A$ and $B$ denote the sets of elements of $S_n$ with $f(1)=1$ and $f(2)=2$ respectively. The number of elements of $S_n$ with both $f(1)\ne1$ and $f(2)\ne2$ is then $$|S_n|-|A\cup B|=|S_n|-|A|-|B|+|A\cap B|.$$

As we are dealing with permutations, $|S_n|=n!$. Now $A$ is basically the set of permutations of $\{2,3,\ldots,n\}$ so $|A|=(n-1)!$. Similarly $|B|=(n-1)!$. Then $A\cap B$ is formed of the permutations with $f(1)=1$ and $f(2)=2$. These permute $\{3,4,\ldots,n\}$ freely, so there are $(n-2)!$ of them, etc.