Just tried it and ChatGPT’s 4o model got it wrong like you said until I added the line “think step by step”, which is always a good idea for these kinds of logic puzzles.
ChatGPT o1 got the answer correct with no tweaks to the prompt.
ChatGPT o1 got the answer correct with no tweaks to the prompt.