Test whether a collection contains `n` elements which pass a test implemented by a predicate function.