Hexadecimal variants for Black/White images

Hello Blenderartists!
The Hexadecimal color code (#RRGGBB) should be capable of 16,777,216 different colors, if I calculated this correctly (6^16), but how many colors will be left when working with Black/White (and grey-scale) colors only? And how do I know which codes are Black/White only? Fpr they seem to be specific, like #D2D2D2 or #FEFEFE or #A6A6A6 etc.

If there´s a possible (math?) solution for this, please let me know!

Thanks all of you beforehand
NGCHunter2