Use collections module to compute histogram.