LaTeX overbrace with text

The overbrace command makes an overbrace and insert a text.

\[
\overbrace{PQ} \\~\\
\overbrace{a_1 \cdots a_n} \\~\\
\overbrace{a_1 \cdots a_n}^{n}
\]

\[ \overbrace{PQ} \\~\\ \overbrace{a_1 \cdots a_n} \\~\\ \overbrace{a_1 \cdots a_n}^{n} \]

LaTeX equation

LaTeX