5. Given the set $S=\{1,2,3, \cdots, 2 n, 2 n+1\}$, a subset $T$ of which has the property that for any three elements $x, y, z$, $x+y \neq z$, then the maximum number of elements in $T$ is $\qquad$.
5. $n+1$.

Solution: Let $T$ contain a total of $k$ elements. Subtracting the other elements from the largest element in $T$, the differences obtained are not in $T$. Therefore, we have
$k+(k-1) \leqslant 2 n+1$, which means $k \leqslant n+1$. Additionally, the subset $\{n+1, n+1, \cdots, 2 n+1\}$ of $S$ contains $n+1$ elements, which clearly meets the requirements of the problem. Hence, the maximum value of $k$ is $n+1$.