Minimalistic approach for n=2: (which incorrectly ends with the other color to move)
White to move must 0-0-0 to prevent a pawn move, capture or mate.
It can then give the black King some space with a3b3 and eventually get into the same position with e.g. Rba1 Kb8 Rba3. (and then 0-0-0 is not available anymore)
[FEN "1k6/1ppP4/8/8/8/R4p2/2PPPrp1/R3K3 w Q - 0 1"]
1. O-O-O Rf1 2. Rb3 Ka7 3. Kb2 Rf2 4. Rb1 Kb8 5. Kc1 Ka7 6. Kd1 Ka8 7. Ke1 Ka7 8. Ra1+ Kb8 9. Rba3