CostWriter: return the count of written coefficients