I am trying to figure out how to calculate the number of ways to arrange a consecutive string of letters with no letter in the alphabetically correct place. For example, if we take $ABC$, then there are 6 possible arrangements:
$$ABC, ACB, BAC, BCA, CAB, CBA$$
but only in the last two none of the letters is in the alphabetically correct place (for example, $BAC$ does not satisfy the requirement, since $C$ is a third letter of the alphabet and it is in the third spot in $BAC$)
If we take $ABCD$ there are $4!=24$ possible arrangements, but by inspection one can see that only $9$ of the arrangements satisfy the given requirement.
My question is: what's the formula for calculating the number of ways to arrange a consecutive string of letters with no letter in the alphabetically correct place and how to deduce such a formula?
In fact, I am also trying to understand the following: why does the ratio of all the possible arrangements to the arrangements satisfying the extra condition converge to the famous Euler's number $e$?
As always, any help will be greatly appreciated.