Variantly: "He found them in a desert land": This refers to Israel, as it is written (Hoshea 9:10) "As grapes in the desert, I found Israel."
"and in a wasteland, howling and desolate": in a place of afflictions, invaders, and marauders.
"He surrounded them": before Mount Sinai, viz. (Shemoth 19:12) "And you shall set bounds to the people roundabout, saying, etc."
"He invested them with understanding": with the ten commandments. We are hereby taught that the Word left the mouth of the Holy One Blessed be He, and Israel perceived it and knew how many midrashim it contained, how many halachoth it contained, how many leniencies and stringencies it contained and how many gezeiroth shavoth (identities) it contained.