Answer
$2$
Work Step by Step
Given
$$ y=\cos x,\ \ \ y=\cos^2 x ,\ \ \ x=0,\ \ x=\pi$$
Since
\begin{aligned}
\cos^2 x &= \cos x\\
\cos x(\cos x-1)&= 0
\end{aligned}
Then $x=0,\ \ x=\pi/2$, since
\begin{aligned}
\cos x \geq \cos^2 x &\ \ \ 0\leq \ x\leq \pi/2\\
\cos^2 x \geq \cos x &\ \ \ \pi/2\leq \ x\leq \pi
\end{aligned}
Then
\begin{aligned}
A & =\int_0^{\pi / 2}\left(\cos x-\cos ^2 x\right) d x+\int_{\pi / 2}^\pi\left(\cos ^2 x-\cos x\right) d x \\
& =\left[\sin x-\frac{1}{2} x-\frac{1}{4} \sin 2 x\right]_0^{\pi / 2}+\left[\frac{1}{2} x+\frac{1}{4} \sin 2 x-\sin x\right]_{\pi / 2}^\pi\\
&=\left[\left(1-\frac{\pi}{4}\right)-0\right]+\left[\frac{\pi}{2}-\left(\frac{\pi}{4}-1\right)\right]\\
&=2
\end{aligned}