In the homogeneous and isotropic FRW Universe, the collisionless Boltzmann equation is given by $$ E\frac{\partial f}{ \partial t}-\frac{\dot{a}}{a}|\textbf{p}|^2\frac{\partial f}{\partial E}=0\tag{1}$$ where the phase space distribution $f$ is a function of the particle's energy $E$ and time $t$. See page 116 of The Early Universe by E. Kolb and M. Turner. The number density of the particle species at any time is given by $$n(t)=\frac{g}{(2\pi)^3}~\int d^3\textbf{p} f(E,t).\tag{2}$$ In Kolb and Turner's book, it is mentioned that by using (2) and doing an integration by parts, Eq.(1) can be reduced to $$\frac{dn}{dt}+3\frac{\dot{a}}{a}n=0.\tag{3}$$
How do we derive Eq.(3)?
My attempt
Taking derivatives of (2) w.r.t $t$ and $E$, we find, $$\frac{dn}{dt}=\frac{g}{(2\pi)^3}\int d^3\textbf{p}~\frac{\partial f}{\partial t},\tag{4}$$ $$\frac{dn}{dE}=\frac{g}{(2\pi)^3}\int d^3\textbf{p}~\frac{\partial f}{\partial E}\tag{5}.$$ Eq.(4) trivially gives the first term of Eq.(3) upon integration by $d\Pi=\frac{g}{(2\pi)^3}\frac{d^3\textbf{p}}{2E}$. But the second term becomes $$-\frac{\dot{a}}{a}\int \frac{|\textbf{p}|^2}{2E}\frac{\partial f}{\partial E}\frac{g~d^3\textbf{p}}{(2\pi)^3}.$$
Any help?