Number Of Distinct Categories Derivation