Fixed bug in calculating number of dense monomials.