Mishkat al-Masabih 1347
عَنِ ابْنِ عُمَرَ قَالَ: صَلَّى رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ بمنى رَكْعَتَيْنِ وَأَبُو بَكْرٍ بَعْدَهُ وَعُمَرُ بَعْدَ أَبِي بَكْرٍ وَعُثْمَانُ صَدَرًا مِنْ خِلَافَتِهِ ثُمَّ إِنَّ عُثْمَانَ صَلَّى بَعْدُ أَرْبَعًا فَكَانَ ابْنُ عُمَرَ إِذَا صَلَّى مَعَ الْإِمَامِ صَلَّى أَرْبَعًا وَإِذَا صلاهَا وَحده صلى رَكْعَتَيْنِ
From Ibn ʿUmar, who said: The Messenger of Allah ﷺ prayed two rakʿahs at Mina, and Abu Bakr after him, and ʿUmar after Abu Bakr, and ʿUthman in the early part of his caliphate. Then ʿUthman later prayed four. So when Ibn ʿUmar prayed with the imam he prayed four, and when he prayed it alone he prayed two rakʿahs.