Measurements of moments of the hadronic mass distribution in semileptonic B decays