Database
[{_id:ObjectId("629f2f5e7aa147d6503957d0"),a:7},{_id:ObjectId("629f2f5e7aa147d6503957d1"),a:8},{_id:ObjectId("629f2f5e7aa147d6503957d2"),a:9},{_id:ObjectId("629f2f5e7aa147d6503957d3"),a:10}]
Query
db.collection.aggregate([{$match:{a:{$in:[7,8,9]}}},{$facet:{total:[{$group:{_id:null,count:{$sum:1}}}],data:[{$skip:1}]}},{$project:{data:1,total:{$first:"$total.count"}}}])