A set $S$ is called neighbouring if it has the following two properties:
a) $S$ has exactly four elements

b) for every element $x$ of $S$, at least one of the numbers $x-1$ or $x+1$ belongs to $S$.

Find the number of all neighbouring subsets of the set $\{1,2, \ldots, n\}$.
Let us denote with $a$ and $b$ the smallest and the largest element of a neighbouring set $S$, respectively. Since $a-1 \notin S$, we have that $a+1 \in S$. Similarly, we conclude that $b-1 \in S$. So, every neighbouring set has the following form $\{a, a+1, b-1, b\}$ for $b-a \geq 3$. The number of the neighbouring subsets for which $b-a=3$ is $n-3$. The number of the neighbouring subsets for which $b-a=4$ is $n-4$ and so on. It follows that the number of the neighbouring subsets of the set $\{1,2, \ldots, n\}$ is:

$$
(n-3)+(n-4)+\cdots+3+2+1=\frac{(n-3)(n-2)}{2}
$$