Example 2 Let $S=\{1,2, \cdots, n\}, A$ be an arithmetic sequence with at least two terms and a positive common difference, all of whose terms are in $S$, and adding any other element of $S$ to $A$ does not form an arithmetic sequence with the same common difference as $A$. Find the number of such $A$ (here, a sequence with only two terms is also considered an arithmetic sequence). (1991 National High School League Question)
When $n=2 k$, for each sequence $A$ that satisfies the problem's requirements, there are two consecutive terms, such that the former term is in the set $\{1,2, \cdots, k\}$, and the latter term is in the set $\{k+1, k+2, \cdots, 2 k\}$; conversely, taking one number from $\{1,2, \cdots, k\}$ and one from $\{k+1, k+2, \cdots, 2 k\}$, and using the difference of these two numbers as the common difference, a sequence $A$ that meets the requirements can be constructed. It is easy to see that this correspondence is one-to-one, i.e., a bijection. Therefore, the number of $A$ is $k \cdot k=\frac{1}{4} n^{2}$.

When $n=2 k+1$, for each sequence $A$ that satisfies the problem's requirements, there must be two consecutive terms, such that the former term is in the set $\{1,2, \cdots, k\}$, and the latter term is in the set $\{k+1, k+2, \cdots, 2 k+1\}$. The discussion is similar to the previous case. Therefore, the number of $A$ in this case is $k \cdot(k+1)=\frac{1}{4}\left(n^{2}-1\right)$.

Combining both cases, there are $\left[\frac{n^{2}}{4}\right]$ sequences $A$.