Let the number of counties in state B be n, then the number of counties in state A is n+2 (the next even integer number after n). The sum of these two consecutive integers is 142, then
n+n+2=142,
2n=142-2,
2n=140,
n=70.
In state B there are 70 counties, and in state A there are 72 counties.