Let $S_n$ be the number of quasi-increasing permutations of $1, 2, \ldots, n$. It is easy to check that $S_1 = 1$, $S_2 = 2$, and $S_3 = 6$. For $n \geqslant 3$, $S_n = 3S_{n-1}$ is proved as follows. First note that if $a_1, a_2, \ldots, a_{n-1}$ is a quasi-increasing permutation of $1, 2, \ldots, n - 1$, then one can construct a quasi-increasing permutation of $1, 2, \ldots, n$ by placing the $n$ immediately in front of $n - 1$, immediately in front of $n - 2$, or after $a_{n-1}$. If $n$ is placed in any other position, then it will be followed by an integer $k$ with $1 \leqslant k \leqslant n - 3$ so $n \leqslant k + 2$ will not be true. Thus every quasi-increasing permutation of $1, 2, \ldots, n - 1$ leads to $3$ quasi-increasing permutations of $1, 2, \ldots, n$. Conversely, suppose that we have a quasi-increasing permutation $a_1, a_2, \ldots, a_n$ of $1, 2, \ldots, n$. If $a_n = n$ or $a_1 = n$, then removing $a_n$ results in a quasi-increasing permutation of $1, 2, \ldots, n - 1$. If $n = a_k$, $k \ne 1, n$, then $a_{k+1} = n - 1$ or $a_{k+1} = n - 2$. In either case \[ a_{k-1} < n \leqslant a_{k+1} + 2, \] so removing $n$ again results in a quasi-increasing permutation of $1, 2, \ldots, n - 1$. Furthermore, as the previous paragraph showed, for each quasi-increasing permutation $\pi$ of $1, 2, \ldots, n - 1$, there are exactly $3$ quasi-increasing permutations of $1, 2, \ldots, n$ that result in $\pi$ when $n$ is removed. This completes the proof that $S_n = 3S_{n-1}$ for $n \geqslant 3$. Hence $S_n = 3^{n-2} S_2 = 2 \cdot 3^{n-2}$ for $n \geqslant 3$. In particular, $S_7 = 2 \cdot 3^5 = 486$.