For me, both Sonnet and Haiku gave the right answer:

i.ibb.co/m5mTQQyn/image.png

i.ibb.co/jvcZx7ZN/image.png

chatgpt fails though:

i.ibb.co/9kTVFSxp/image.png

gemini “fast” waffles a lot but does eventually give the right answer:

i.ibb.co/84KR0s94/image.png