I've read that the generalized Gauss-Bonnet theorem states that
$$\int\limits_{M}Pf(\Omega)=(2\pi)^n\chi(M)$$
where, $M$ is a 2n-dimensional compact orientable Riemannian manifold without boundary $\Omega$ is the curvature form and $Pf(\Omega)$ is the Pfaffian of $\Omega$, $Pf(\Omega)$ is a 2n-form.
How can I prove that in dimension four is valid:
$$\chi(M)=\frac{1}{32\pi^2}\int\limits_M(|Rm|^2-4|Ric|^2+R^2)\,d\mu$$
where, $Rm$ is the Riemannian curvature tensor, $Ric$ is the Ricci curvature tensor ans $R$ is then scalar curvature.
Tahnks in advice.