Keys-space for a restricted substitution cipher How can one calculate the key-space for a restricted substitution cipher? A restricted substitution cipher is one where no letter is assigned to itself. For an alphabet with 26  letters how many keys are there for a restricted substitution cipher? What is the correct way to approach this question? I have been adviced to look into cycle notations, Markov chains and the structure of the symmetric group and its conjugacy classes.
It is called derangement, see Wikipedia.
Also, in Mathematics Stack Exchange 1, 2 

Number of derangements of n elements $=\sum\limits_{k = 0}^{n}(-1)^k\frac{n!}{k!}$

When n = 26 the result is 148362637348470135821287825 $\approx 2^{87} $