Two brothers, Jim and John, had a straight log in their backyard. Jim wanted the log cut into 24 equal parts. He painted red lines on the log and called to a lumberjack to cut the log by the painted lines. John wanted the log cut too, but into 18 equal parts. He painted yellow lines on the log with some yellow lines painted over red lines. The lumberjack came and cut the log by the painted lines. How many cuts did the lumberjack make?