7 (1) Discuss the number of roots of the equation $|x+1|+|x+2|+|x+3|=a$ with respect to $x$.
(2) Let $a_{1}, a_{2}, \cdots, a_{n}$ be an arithmetic sequence, and
$$
\begin{aligned}
& \left|a_{1}\right|+\left|a_{2}\right|+\cdots+\left|a_{n}\right| \\
= & \left|a_{1}+1\right|+\left|a_{2}+1\right|+\cdots+\left|a_{n}+1\right| \\
= & \left|a_{1}-2\right|+\left|a_{2}-2\right|+\cdots+\left|a_{n}-2\right|=507,
\end{aligned}
$$

Find the maximum value of the number of terms $n$. (Lin Chang)
(1) According to the graph of the function $y=|x+1|+|x+2|+|x+3|=a$, we can see that:
When $a>2$, the equation has two roots.
(2) Since the equation $|x|=|x+1|=|x-2|$ has no solution, it follows that $n \geqslant 2$ and the common difference is not 0. Without loss of generality, let the terms of the sequence be $a-k d(1 \leqslant k \leqslant n, d>0)$. Consider the function
$$
f(x)=\sum_{k=1}^{n}|x-k d|,
$$

The condition of this problem is equivalent to $f(x)=507$ having at least three different roots $a, a+1, a-2$. This condition is also equivalent to the graph of $y=f(x)$ having at least three different intersection points with the horizontal line $y=507$.

Since the graph of $y=f(x)$ is a downward convex broken line consisting of $n+1$ segments symmetric about the line $y=\frac{(n+1) d}{2}$, it intersects the horizontal line $L$ at three points if and only if there is a horizontal segment on $L$, which happens if and only if $n=2 m$ and $a, a+1, a-2 \in[m d, (m+1) d]$, and $f(m d)=507$. That is, $d \geqslant 3$ and $m^{2} d=507$.
From this, we get $m^{2} \leqslant \frac{507}{3}, m \leqslant 13$.
Clearly, when $m=13$, taking $d=3, a=4$ satisfies the conditions of this problem. Therefore, the maximum value of $n$ is 26.