My solution is
<deleted, reason: potential answer>
The offical solution provides two solutions, the first of which is incorrect:
<deleted, reason: potential answer>
The first solution does not count documents where pop
is equal to 5000 or 1000000 exactly. While incorrect, it works flukily because there are no such documents.