CMIMC 2017 Team Problem 5

We have four registers, R_{1}, R_{2}, R_{3}, R_{4}, such that R_{i} initially contains the number i for 1 \leq i \leq 4. We are allowed two operations:

  • Simultaneously swap the contents of R_{1} and R_{3} as well as R_{2} and R_{4}.
  • Simultaneously transfer the contents of R_{2} to R_{3}, the contents of R_{3} to R_{4}, and the contents of R_{4} to R_{2}. (For example if we do this once then \left(R_{1}, R_{2}, R_{3}, R_{4}\right)=(1,4,2,3).)

Using these two operations as many times as desired and in whatever order, what is the total number of possible outcomes?