Dont need to sort if you're just counting.

Also refactor so that we just pass a number not an array.