Count with predicate