  Let $S(t) = \tfrac{1}{\pi} \arg \zeta \big({1/2} + it \big)$ be the argument
of the Riemann zeta-function at the point $\tfrac12 + it$. For $n \geq 1$ and
$t>0$ define its antiderivatives as \begin{equation*} S_n(t) = \int_0^t
S_{n-1}(\tau) \hspace{0.08cm} \rm d\tau + \delta_n, \end{equation*} where
$\delta_n$ is a specific constant depending on $n$ and $S_0(t) := S(t)$. In
1925, J. E. Littlewood proved, under the Riemann Hypothesis, that $$
\int_{0}^{T}|S_n(t)|^2 \hspace{0.06cm} \rm dt = O(T), $$ for $n\geq 1$. In
1946, Selberg unconditionally established the explicit asymptotic formulas for
the second moments of $S(t)$ and $S_1(t)$. This was extended by Fujii for
$S_n(t)$, when $n\geq 2$. Assuming the Riemann Hypothesis, we give the explicit
asymptotic formula for the second moment of $S_n(t)$ up to the second-order
term, for $n\geq 1$. Our result conditionally refines Selberg's and Fujii's
formulas and extends previous work by Goldston in 1987, where the case $n=0$
was considered.
