Store also the number of entries and the sum of the weights squared for each bin.