1. Given a natural number $n \geq 3$. For an $n$-element set of real numbers $S$, let $A(S)$ denote the set of all strictly increasing three-term arithmetic progressions composed of elements of $S$. How many elements can the set $A(S)$ have at most?
Solution. Let $S=\left\{a_{1}, a_{2}, \ldots, a_{n}\right\}$ and $a_{1}<a_{2}<\ldots<a_{n}$. The number of three-term arithmetic sequences of elements from the set $S$ whose middle element is equal to the term $a_{k}$ is not greater than $\min \{k-1, n-k\}$, since the first term of these sequences can be one of the elements $a_{1}, a_{2}, \ldots, a_{k-1}$, and the last one can be one of the elements $a_{k+1}, \ldots, a_{n}$. Therefore, the set $A(S)$ has at most

$$
\sum_{k=1}^{n} \min \{k-1, n-k\}=x_{n}
$$

elements. If $n=2 m$, then

$$
x_{n}=x_{2 m}=2(1+2+\ldots+(m-1))=m(m-1)=\left[\frac{n-1}{2}\right]\left[\frac{n}{2}\right]
$$

If $n=2 m+1$, then

$$
x_{n}=x_{2 m+1}=2(1+2+\ldots+(m-1))+m=m^{2}=\left[\frac{n-1}{2}\right]\left[\frac{n}{2}\right]
$$

Moreover, if $S=\{1,2, \ldots, n\}$, then the set $A(S)$ has exactly $x_{n}$ elements.