Constraints on a system of two neutral fermions from cosmology