Hi Tom
I'd say both are fine, but would be used for different reasons.
In your first sentence, the stress is on location (locative there).
"
How many people were at the party?" --> He asked me how many people were there. (there = at the party)
The use of 'there' in your second sentence could be more existential.
"
There are how many people being interviewed for that job?!" --> He asked me how many people there were (being interviewed for the job).