Sahih al-Bukhari, Book 97, Hadith 21 (Bukhari 7110)

Narrated Abu Huraira:

Allah's Messenger (ﷺ) said, "Allah has ninety-nine Names, one-hundred less one; and he who memorized them all by heart will enter Paradise." To count something means to know it by heart.