Count delete flags in script? (black x)

Is there a way to count the number of documents at the view level that have been marked for deletion? In script? I cant find a way.

Subject: What are you trying to do?

Why do you want to count them and what do you want to do once you know the count?