Problem: How many solutions does the equation $\sin \left( \frac{\pi}2 \cos x\right)=\cos \left( \frac{\pi}2 \sin x\right)$ have in the closed interval $[0,\pi]$
$\textbf{(A) }0 \qquad \textbf{(B) }1 \qquad \textbf{(C) }2 \qquad \textbf{(D) }3\qquad \textbf{(E) }4$

Solution: This problem is equivalent to counting the intersections of the graphs of $y=\sin\left(\frac{\pi}{2}\cos x\right)$ and $y=\cos\left(\frac{\pi}{2}\sin x\right)$ in the closed interval $[0,\pi].$ We construct a table of values, as shown below: \[\begin{array}{c|ccc} & & & \\ [-2ex] & \boldsymbol{x=0} & \boldsymbol{x=\frac{\pi}{2}} & \boldsymbol{x=\pi} \\ [1.5ex] \hline & & & \\ [-1ex] \boldsymbol{\cos x} & 1 & 0 & -1 \\ [1.5ex] \boldsymbol{\frac{\pi}{2}\cos x} & \frac{\pi}{2} & 0 & -\frac{\pi}{2} \\ [1.5ex] \boldsymbol{\sin\left(\frac{\pi}{2}\cos x\right)} & 1 & 0 & -1 \\ [1.5ex] \hline  & & & \\ [-1ex] \boldsymbol{\sin x} & 0 & 1 & 0 \\ [1.5ex] \boldsymbol{\frac{\pi}{2}\sin x} & 0 & \frac{\pi}{2} & 0 \\ [1.5ex] \boldsymbol{\cos\left(\frac{\pi}{2}\sin x\right)} & 1 & 0 & 1 \\ [1ex] \end{array}\] For $x\in[0,\pi],$ note that:
For the graphs to intersect, we need $\sin\left(\frac{\pi}{2}\cos x\right)\in[0,1].$ This occurs when $\frac{\pi}{2}\cos x\in\left[0,\frac{\pi}{2}\right].$
By the Cofunction Identity $\cos\theta=\sin\left(\frac{\pi}{2}-\theta\right),$ we rewrite the given equation: \[\sin\left(\frac{\pi}{2}\cos x\right) = \sin\left(\frac{\pi}{2}-\frac{\pi}{2}\sin x\right).\] Since $\frac{\pi}{2}\cos x\in\left[0,\frac{\pi}{2}\right]$ and $\frac{\pi}{2}\sin x\in\left[0,\frac{\pi}{2}\right],$ it follows that $x\in\left[0,\frac{\pi}{2}\right]$ and $\frac{\pi}{2}-\frac{\pi}{2}\sin x\in\left[0,\frac{\pi}{2}\right].$
We can apply the arcsine function to both sides, then rearrange and simplify: \begin{align*} \frac{\pi}{2}\cos x &= \frac{\pi}{2}-\frac{\pi}{2}\sin x \\ \sin x + \cos x &= 1. \end{align*} From Case 1 in Solution 2, we conclude that $(0,1)$ and $\left(\frac{\pi}{2},0\right)$ are the only points of intersection, as shown below: [asy] /* Made by MRENTHUSIASM */ size(600,200);   real f(real x) { return sin(pi/2*cos(x)); }  real g(real x) { return cos(pi/2*sin(x)); }  draw(graph(f,0,pi),red,"$y=\sin\left(\frac{\pi}{2}\cos x\right)$"); draw(graph(g,0,pi),blue,"$y=\cos\left(\frac{\pi}{2}\sin x\right)$");  real xMin = 0; real xMax = 5/4*pi; real yMin = -2; real yMax = 2;  //Draws the horizontal gridlines void horizontalLines() {   for (real i = yMin+1; i < yMax; ++i)   {     draw((xMin,i)--(xMax,i), mediumgray+linewidth(0.4));   } }  //Draws the vertical gridlines void verticalLines() {   for (real i = xMin+pi/2; i < xMax; i+=pi/2)   {     draw((i,yMin)--(i,yMax), mediumgray+linewidth(0.4));   } }  //Draws the horizontal ticks void horizontalTicks() {   for (real i = yMin+1; i < yMax; ++i)   {     draw((-1/8,i)--(1/8,i), black+linewidth(1));   } }  //Draws the vertical ticks void verticalTicks() {   for (real i = xMin+pi/2; i < xMax; i+=pi/2)   {     draw((i,-1/8)--(i,1/8), black+linewidth(1));   } }  horizontalLines(); verticalLines(); horizontalTicks(); verticalTicks(); draw((xMin,0)--(xMax,0),black+linewidth(1.5),EndArrow(5)); draw((0,yMin)--(0,yMax),black+linewidth(1.5),EndArrow(5)); label("$x$",(xMax,0),(2,0)); label("$y$",(0,yMax),(0,2));  pair A[]; A[0] = (pi/2,0); A[1] = (pi,0); A[2] = (0,1); A[3] = (0,0); A[4] = (0,-1);  label("$\frac{\pi}{2}$",A[0],(0,-2.5)); label("$\pi$",A[1],(0,-2.5)); label("$1$",A[2],(-2.5,0)); label("$0$",A[3],(-2.5,0)); label("$-1$",A[4],(-2.5,0));  dot((0,1),linewidth(5));  dot((pi/2,0),linewidth(5));   add(legend(),point(E),40E,UnFill); [/asy] Therefore, the answer is $\boxed{2}.$

Answer: C 2