The teacher buys 24 small boxes, 12 medium boxes, and 5 large boxes. She had to return 3 small boxes due to defects. How many colored pencils does the teacher have in all?