Census & senses – Pinchas
Num. 25:19 tells us that after the drama involving Pinchas there was a plague in the camp.
The next verse, Num. 26:1, relates that God commanded Moses and Elazar the priest to carry out a census of the people.
The connection is provided by Ibn Ezra, who says that the plague was caused by the immorality in the camp, and it became necessary to re-group and re-organise the people on the basis of statistics of the survivors of the episode.
It was these survivors upon whom the future of the people would depend, beginning in the first instance by the entry into the Promised Land.