computing histogram