Example 1 (An Ancient Chinese Mathematical Problem) Emperor Taizong of Tang ordered the counting of soldiers: if 1,001 soldiers make up one battalion, then one person remains; if 1,002 soldiers make up one battalion, then four people remain. This time, the counting of soldiers has at least $\qquad$ people.
Let the first troop count be 1001 people per battalion, totaling $x$ battalions, then the total number of soldiers is $1001 x + 1$ people; let the second troop count be 1002 people per battalion, totaling $y$ battalions, then the total number of soldiers is $1002 y + 4$ people.
From the equality of the total number of soldiers, we get the equation
$$
1001 x + 1 = 1002 y + 4 \text{. }
$$

Rearranging gives
$$
1001(x - y) - 3 = y \text{. }
$$

Since $x$ and $y$ are both positive integers, the smallest value for $x - y$ is 1, at which point, $y = 998$.
Thus, the minimum number of soldiers in this troop count is
$$
998 \times 1002 + 4 = 1000000 \text{ (people). }
$$