AMC 12A 2021 Spring Problem 19

How many solutions does the equation \sin \left(\dfrac{\pi}{2} \cos x\right)=\cos \left(\dfrac{\pi}{2} \sin x\right) have in the closed interval [0, \pi] ?

Answer Choices
A. 0
B. 1
C. 2
D. 3
E. 4