2. Let $X$ be an $n$-element set. Let $Y_{1}, Y_{2}, \ldots, Y_{k}$ be distinct subsets of $X$ such that for all $i, j, i \neq j$, we have $\left|Y_{i} \cap Y_{j}\right| \leqslant 2$. Determine the maximum possible value of the number $k$.
2. It is possible to achieve $k=1+n+\binom{n}{2}+\binom{n}{3}$ by taking all subsets of the set $X$ with cardinality not greater than 3. We need to prove that this is the maximum possible value of the number $k$. It is sufficient to show that in the selected collection $Y_{1}, Y_{2}, \ldots, Y_{k}$ for the maximum $k$, there are no sets with cardinality greater than 3. Assume the opposite: let, for example, $Y_{1}$ have a cardinality of at least 4. Let $Z_{1}, Z_{2}, \ldots, Z_{t}$ be all the three-element subsets of the set $Y_{1}$; there are at least 4 of them. The collection $Z_{1}, Z_{2}, \ldots, Z_{t}, Y_{2}, \ldots, Y_{k}$ also satisfies the conditions of the problem and includes more than $k$ sets, which is a contradiction to the maximality of the number $k$. Thus, the proof is complete.