In how many different ways can they be arranged on a shelf if books in the same category are kept next to one another?