Removing Ostrogradski's ghost from cosmological perturbations in
  $f(R,R_{\mu\nu}^2,C_{\mu\nu\rho\sigma}^2)$ gravity
  Recently it was argued that gravity with the squire of the Ricci tensor can
be stabilized by adding constraints to the theory. This was so far demonstrated
for fluctuations on the Minkowski/de Sitter background. We show that the same
scheme works equally well for removing Ostrogradski's ghost from fluctuations
on a cosmological background in generic
$f(R,R_{\mu\nu}^2,C_{\mu\nu\rho\sigma}^2)$-type theories of gravity. We also
derive the general formula for the spectrum of primordial tensor perturbations
from the stabilized theory.
