Use a lambda for counting occurrances in histogram