Nearest Neighbor Queries with Counting Aggregate-based Conditions