The Messenger of Allah ﷺ said two rak'ahs at Mina, and Abu Bakr after him, and 'Umar after Abu Bakr, and 'Uthman at the beginning of his caliphate; then 'Uthman observed four rak'ahs, and when Ibn 'Umar prayed with the Imam, he said four rak'ahs, but when he observed prayer alone, he said two rak'ahs.
صَلَّى رَسُولُ اللَّهِ ﷺ بِمِنًى رَكْعَتَيْنِ وَأَبُو بَكْرٍ بَعْدَهُ وَعُمَرُ بَعْدَ أَبِي بَكْرٍ وَعُثْمَانُ صَدْرًا مِنْ خِلاَفَتِهِ ثُمَّ إِنَّ عُثْمَانَ صَلَّى بَعْدُ أَرْبَعًا فَكَانَ ابْنُ عُمَرَ إِذَا صَلَّى مَعَ الإِمَامِ صَلَّى أَرْبَعًا وَإِذَا صَلاَّهَا وَحْدَهُ صَلَّى رَكْعَتَيْنِ