how many permutations of {1,2,...,9} How many permutations of {1,2,…,9} are there such that 1 does not immediately precede 2, 2 does not immediately precede 3, and so forth up to 8 not immediately preceding 9? One obvious example of such a permutation might be 987654321, but there are many others, such as 132465879 or 351724698.
For $\{1,2,3,\dots,n\}$, the numbers are tabulated here, along with lots of information, formulas, references, links, and whatnot. For $n=9$, it says 148329.
Let us do it step by step 

First take total permutation = 9!(With out any constraint and no repetition)

Ok then as we know 12 in a sequence is not allowed so calculate total number of permutation when there is 12 = 7!

There are total 8 pairs so Ans should be 9!-8*(7!)=322560