The Messenger of Allah ﷺ stayed for nineteen days praying two rakahs at a time. So when we stay for nineteen days, we pray two rakahs at a time, and when we stay longer than that, we pray four.
حدثنا محمد بن عبد الملك بن أبي الشوارب حدثنا عبد الواحد بن زياد حدثنا عاصم الأحول عن عكرمة
أقام رسول الله ﷺ تسعة عشر يوما يصلي ركعتين ركعتين فنحن إذا أقمنا تسعة عشر يوما نصلي ركعتين ركعتين فإذا أقمنا أكثر من ذلك صلينا أربعا
Bukhari narrated it in the chapters on shortening the prayer, in the chapter on what has been said about shortening the prayer, and how long one may stay before shortening it, hadith no. 1080, 298, 4299, from the hadith of Asim and others, both at length and in brief.