> 
> Find the number of permutations of the set $\left\{ 1,2,3,4,5,6,7\right\} $ not containing four consecutive elements of ascending order.
> 
> 
> 

**My try:**

All permutations in cycles are $6!$.   

Let's deal with cases that do not meet the requirements of the task:

* When four growing elements are not at the beginning:

 - choice of beginning: ${3 \choose 1}$

 - choice of four numbers ${6 \choose 4}$

 So: $${3 \choose 1}\cdot {6 \choose 4}\cdot 2!=90$$
* When four growing elements are at the beginning:

 $${6 \choose 3}\cdot 3!=120$$

Then we must count cases common to the previous two considerations: $${6 \choose 4}\cdot2!=30$$That is why my answer is: 
$$6!-90-120+30=540$$
However I wrote a Python program to check the number of solutions and he says it's $342$ so I have a mistake.  

Can you help me and tell me what I'm doing wrong?