Allah, the Exalted, prescribed prayer for you, through the tongue of your Prophet ﷺ, four rak'ahs while resident, two rak'ahs while travelling and one rak'ah in time of danger. (Using translation from Abū Dāʾūd 1247)
«افْتَرَضَ اللهُ الصَّلَاةَ عَلَى لِسَانِ نَبِيِّكُمْ ﷺ فِي الْحَضَرِ أَرْبَعًا وَفِي السَّفَرِ رَكْعَتَيْنِ وَفِي الْخَوْفِ رَكْعَةً»