"All these are the twelve tribes of Israel" (Genesis 49:28). But elsewhere it is written: "He shall beget twelve princes" (Genesis 17:20). And these tribes correspond to the order of the world: twelve hours in the day and twelve hours in the night. And likewise the constellations and the months, and the twelve stones of the ephod. Therefore, "All these are the twelve tribes of Israel." Rabbi Yochanan said: But are there twelve tribes? Has it not already been said, "Ephraim and Manasseh shall be mine, like Reuben and Simeon" (Genesis 48:5), making fourteen? Rather, when Levi is counted with them, they are not counted with him; and when Levi is not counted with them, Ephraim and Manasseh are counted as one tribe. From where do we know this? For so it is written: "For the sons of Joseph: for Ephraim, Elishama; for Manasseh, Gamliel" (Numbers 1:10). Thus, "All these are the twelve tribes of Israel," neither fewer nor more. And Rebecca too saw them as twelve, as it is written: "And the LORD said to her: Two nations (goyim) are in your womb" (Genesis 25:23), behold two. "And two peoples (le'umim)," behold four. "And one people shall be stronger than the other people (u-le'om mi-le'om)," behold six. "And the elder shall serve the younger (ve-rav yaavod tza'ir)," behold eight. "And behold, there were twins (tomim) in her womb," behold ten. "And the first came out, and after that came out his brother," behold twelve. And there are those who derive it from here: "Why is this (lamah zeh)" (Genesis 25:22) equals twelve in gematria [the word "zeh" has the numerical value of twelve]. When the children struggled within her womb, she said: If I am so distressed over twelve, of whom the Holy One, blessed be He, said to me that twelve are destined to come forth from me, then "If so, why is this that I am?" (Genesis 25:22).
All These Are the Twelve Tribes of Israel
Midrash Tanchuma, Vayechi 15
כָּל אֵלֶּה שִׁבְטֵי יִשְׂרָאֵל שְׁנֵים עָשָׂר. אֲבָל לְהַלָּן כְּתִיב: שְׁנֵים עָשָׂר נְשִׂיאִם יוֹלִיד (בראשית יז, כ). וְאֵלּוּ שְׁבָטִים עַל סִדְרוֹ שֶׁל עוֹלָם, שְׁתֵּים עֶשְׂרֵה שָׁעוֹת בַּיּוֹם וּשְׁתֵּים עֶשְׂרֵה שָׁעוֹת בַּלָּיְלָה. וְכֵן הַמַּזָּלוֹת וְהֶחֳדָשִׁים, וּשְׁתֵּים עֶשְׂרֵה אַבְנֵי הָאֵפוֹד. לְפִיכָךְ כָּל אֵלֶּה שִׁבְטֵי יִשְׂרָאֵל שְׁנֵים עָשָׂר. אָמַר רַבִּי יוֹחָנָן, וְכִי שְׁנֵים עָשָׂר שְׁבָטִים הֵן. וַהֲלֹא כְּבָר נֶאֱמַר, אֶפְרַיִם וּמְנַשֶּׁה כִּרְאוּבֵן וְשִׁמְעוֹן, וְהֵן אַרְבָּעָה עָשָׂר. אֶלָּא כְּשֶׁלֵּוִי נִמְנֶה עִמְּהֶן, אֵינָן נִמְנִין עִמּוֹ. וּכְשֶׁאֵין לֵוִי נִמְנֶה עִמָּהֶן, אֶפְרַיִם וּמְנַשֶּׁה נִמְנִין שֵׁבֶט אֶחָד. מִנַּיִן, שֶׁכֵּן כְּתִיב: לִבְנֵי יוֹסֵף לְאֶפְרַיִם אֱלִישָׁמָע, לִמְנַשֶּׁה גַּמְלִיאֵל (במדבר א, י). הֱוֵי, כָּל אֵלֶּה שִׁבְטֵי יִשְׂרָאֵל שְׁנֵים עָשָׂר, לֹא פָחוֹת וְלֹא יוֹתֵר. וְאַף רִבְקָה רָאֲתָה אוֹתָן שְׁנֵים עָשָׂר, דִּכְתִיב: וַיֹּאמֶר ה' לָהּ שְׁנֵי גוֹיִם בְּבִטְנֵךְ (בראשית כה, כג), הֲרֵי שְׁנַיִם. וּשְׁנֵי לְאֻמִּים, הֲרֵי אַרְבָּעָה. וּלְאֹם מִלְאֹם יֶאֱמָץ, הֲרֵי שִׁשָּׁה. וְרַב יַעֲבֹד צָעִיר, הֲרֵי שְׁמוֹנָה. וְהִנֵּה תוֹמִים, הֲרֵי עֲשָׂרָה. וַיֵּצֵא הָרִאשׁוֹן, וְאַחֲרֵי כֵן יָצָא אָחִיו, הֲרֵי שְׁנֵים עָשָׂר. וְאִית דְּמַיְתֵי לָהּ מֵהָכָא, לָמָּה זּה, בְּגִימַטְרִיָּא שְׁנֵים עָשָׂר. כֵּיוָן שֶׁנִּתְרוֹצְצוּ הַבָּנִים בְּמֵעֶיהָ, אָמְרָה, כָּךְ אֲנִי מִצְטַעֶרֶת בִּשְׁנֵים עָשָׂר, שֶׁאָמַר לִי הַקָּדוֹשׁ בָּרוּךְ הוּא, שְׁנֵים עָשָׂר עֲתִידִין לַעֲמֹד מִמֶּנִּי, וַתֹּאמֶר אִם כֵּן לָמָּה זֶּה אָנֹכִי.