I took approximately thirty minutes to figure it out last night before I fell asleep. In this case I believe "logic" is a misnomer. It's a math puzzle.
To put it words that do not easily jump out to the person who does not want to be spoiled and find out that the result you have produced is mostly appropriate, I ask, "But which night?"