12. (16 points) Let $n \in \mathbf{Z}_{+}, A=\left\{a_{1}, a_{2}, \cdots, a_{n}\right\}$ be a sequence composed of the numbers 0 or 1, i.e.,
$a_{k}=0$ or $1(1 \leqslant k \leqslant n)$.
(1) If $n \geqslant 3$, define another sequence $A^{\prime}=\left\{a_{1}^{\prime}, a_{2}^{\prime}, \cdots, a_{n}^{\prime}\right\}$ based on the sequence $A$, where,
$$
\begin{array}{l}
a_{k}^{\prime}=\left\{\begin{array}{ll}
0, & a_{k-1}=a_{k+1} ; \\
1, & a_{k-1} \neq a_{k+1},
\end{array}\right. \\
k=1,2, \cdots, n, a_{0}=a_{n}, a_{n+1}=a_{1} \text {. } \\
\end{array}
$$

Find all sequences $A$ such that $a_{k}+a_{k}^{\prime}=1(k=1,2, \cdots, n)$ (only the result is required, no need for the solution process).
(2) Find the number of sequences $A$ such that $a_{1}+a_{2}+\cdots+a_{n}$ leaves a remainder of 3 when divided by 4.
2. 54 .

Notice,
$$
\begin{array}{l}
f(n)=\log _{2} 3 \times \frac{\log _{2} 4}{\log _{2} 3} \times \cdots \times \frac{\log _{2} n}{\log _{2}(n-1)} \\
=\log _{2} n
\end{array}
$$

Thus, $f\left(2^{k}\right)=k$.
Therefore, $f\left(2^{2}\right)+f\left(2^{3}\right)+\cdots+f\left(2^{10}\right)$
$$
=2+3+\cdots+10=54 \text {. }
$$