"When you take up" (Exodus 30:12). Rabbi Joshua the Priest bar Nahmani said: The Holy One, blessed be He, said to Moses, "Go, number Israel." Moses said before the Holy One, blessed be He, "It is written, 'And your seed shall be as the dust of the earth' (Genesis 28:14), and it is written, 'And the number of the children of Israel shall be as the sand of the sea' (Hosea 2:1) — yet You say, 'Go, number Israel'?" Moses said before the Holy One, blessed be He, "I am not able to arrive at their number." The Holy One, blessed be He, said to him, "Moses, it is not as you suppose. Rather, if you seek to arrive at the number of Israel, take the initial letters of the tribes, and you will arrive at their number: a resh from Reuben, a shin from Simeon, a lamed from Levi, and so for each and every tribe." To what is the matter like? To a money-changer who had a lad. He said to him, "Count me these coins." He said to him, "How can I count them?" He said to him, "Count the top of the rows of coins, and you will arrive at the reckoning." So Moses found the reckoning of Israel difficult. The Holy One, blessed be He, said to him, "Take the initial letters of the tribes, and you will arrive at their reckoning: a resh from Reuben — two hundred thousand; a nun from Naphtali — fifty thousand; a shin from Simeon — three hundred thousand; a yod from Judah, a yod from Joseph, a yod from Issachar — thirty thousand; a zayin of Zebulun — seven thousand; a dalet of Dan — four thousand; a gimel of Gad — three thousand; a bet of Benjamin — two thousand; an alef of Asher — one thousand. This makes five hundred and ninety-seven thousand." Where are the three thousand? These are the ones who fell in the days of the calf, as it is said, "And the sons of Levi did according to the word of Moses, and there fell of the people on that day about three thousand men" (Exodus 32:28). Therefore the Holy One, blessed be He, said to Moses, "Number Israel, to know how many are lacking."
Why Moses Counted Israel by the First Letters of the Tribes
Midrash Tanchuma Buber, Ki Tisa 5:1
כי תשא. אמר ר' יהושע הכהן בר נחמני אמר הקב"ה למשה לך מנה את ישראל, אמר משה לפני הקב"ה כתיב והיה זרעך כעפר הארץ וגו' (בראשית כח יד), וכתיב והיה מספר בני ישראל כחול הים וגו' (הושע ב א), ואתה אומר לך מנה את ישראל, אמר משה לפני הקב"ה איני יכול לעמוד על מנינם, א"ל הקב"ה משה לא כשם שאתה סבור אלא אם בקשתה לעמוד על מנינם של ישראל, טול ראשי אותיות של שבטים, ואתה עומד על מנינם, ר' מראובן, ש' משמעון, ל' מלוי, וכן כל שבט ושבט, למה הדבר דומה לשולחני שהיה לו נער, א"ל ספור לי מעות האלו א"ל היאך אני יכול לספור אותם, א"ל ספור ראש שורות של מעות, ותעמוד על החשבון, כך היה משה מתקשה על חשבונן של ישראל, א"ל הקב"ה טול ראשי אויותיהם של שבטים ותעמוד על חשבונן, ר' מראובן מאתים אלף, נ' מנפתלי חמשים אלף, ש' משמעון שלש מאות אלף, י' מיהודה, י' מיוסף, י' מיששכר שלשים אלף, ז' של זבולון שבעת אלפים, ד' של דן ארבעת אלפים, ג' של גד שלשת אלפים, ב' של בנימן ב' אלפים, א' של אשר אלף, הרי חמש מאות אלף ותשעים ושבעה אלף, איכן השלשת אלפים, אלו שנפלו בימי העגל, שנאמר ויעשו בני לוי כדבר משה ויפול מן העם ביום ההוא כשלשת אלפי איש (שמות לב כח), לכך אמר הקב"ה למשה מנה את ישראל לידע כמה חסרו.