Counting occurrence of numbers