Solved the second part of exercise 3.3 (histogram)