From Sahih Bukhari (Hadith 1722):
Narrated Ibn `Abbas:A man said to the Prophet (ﷺ) "I performed the Tawaf-al-Ifada before the Rami (throwing pebbles at the Jamra)." The Prophet (ﷺ) replied, "There is no harm." The man said, "I had my head shaved before slaughtering." The Prophet (ﷺ) replied, "There is no harm." He said, "I have slaughtered the Hadi before the Rami." The Prophet (ﷺ) replied, "There is no harm
Reference: Bukhari 1722