Categorize numbers of an array into different sets and count the occurences : I have a array of numbers. lets say A=  [9,12,16,19]

I have four sets [8,9,10] , [11,12,13] ,[14,15,16], [17,18,19,20]

for each element in A categorize the element into the given sets and count the occurences correspond to each set.

what is the efficient way to do this??

