Least number of moves to achieve a complete switchover of nonpawns in starting setup [fen "RNBQKBNR/8/8/pppppppp/PPPPPPPP/8/8/rnbqkbnr w - - 0 1"]


During a comp, my friend an I had a team kill and we decided to make this position(legally) before drawing. Then we continued to find more and more optimal ways of getting the position until I found this:

[FEN ""]

1. a4 a5 2. Ra3 Ra6 3. Rb3 Rc6 4. Rb6 Rc3 5. Ra6 Ra3 6. Ra8 Ra1 7. h4 h5 8. Rh3 Rh6 9. Rg3 Rf6 10. Rg6 Rf3 11. Rh6 Rh3 12. Rh8 Rh1 13. e3 e6 14. Qg4 Ke7 15. Ke2 Kd6 16. Kf3 Qf6+ 17. Ke4 Kc5 18. d3 Kb4 19. c3+ Kb3 20. Qg5 Kc2 21. Na3+ Kd1 22. Nh3 Qf3+ 23. Kd4 Ke1 24. Qd8 Qd1 25. Ke5 Nh6 26. Ng5 g6 27. Kf6 Bg7+ 28. Ke7 Nc6+ 29. Ke8 Nd4 30. c4 Nf3 31. b3 b6 32. Nb5 Ng1 33. Ba3 Bb2 34. Bf8 Bc1 35. g3 Bb7 36. Bh3 d6 37. Nh7 e5 38. Bc8 Bg2 39. Nf6 Bf1 40. Ng8 Nf5 41. Na7 Nd4 42. Nc6 Ndf3 43. Nb8 Nd2 44. b4 Nb1 45. d4 d5 46. e4 c5 47. f3 b5 48. f4 f5 49. g4 g5


Is there any faster way of achieving this position? And (as an extra question) does anyone have a position that have the longest legal optimal series of moves to achieve it?
As @chakerian's calculations show, 40 moves is the minimum. After a bit of puzzling, I found the solution.
[FEN &quot;&quot;]

1. a4 {First, we need to get the rooks in position. They'll be hard to swap once the board is full.} a5 2. h4 h5 3. Rh3 Rh6 4. Rg3 Rf6 5. Rg6 Rf3 6. Rh6 Rh3 7. Ra3 Ra6 8. Rc3 Rb6 9. Rcc6 Rbb3 10. Ra6 Ra3 {Now, we can start with the knights. They're tricky because they need to swap places via the four center squares. Note that we cannot move the center pawns *before* the knights.} 11. Nf3 Nc6 12. Ne5 Nd4 13. Nc6 Nf6 14. Nc3 Nd5 15. Ne4 Nc3 {It's time for the kings to come out of their hiding, but they have do this carefully because of the knights.} 16. Rh8 d5 17. Ra8 Kd7 18. Nf6+ Kd6 19. e4 Ra1 20. Ba6 b5 21. Nb8 Kc5 {The black monarch chooses queenside - that means his colleague has to take the other one.} 22. Ng8 Nde2 23. d4+ Kc4 24. Kd2 Rh1 25. Ke3 Ng1 26. Kf4 Bh3 27. g4 f5 28. Kg5 e5+ 29. Kg6 Bf1 30. Bh6 {Note how the c1-h6 and a3-f8 diagonals have been left open for the transfer of the last four pieces.} Qg5+ 31. Kf7 Ba3 32. Ke8 Qc1 33. Qd2 Nb1 34. Qg5 {OK, we're almost there now, from here it's a walk in the park.} Qd1 35. b4 Kc3 36. Qd8 g5 37. Bf8 c5 38. Bc8 Kd2 39. c4 Bc1 40. f4 Ke1 {And we're done!}

To answer the second question: you're looking for the longest unique proof game. I found the longest known one here and here.
[Title &quot;Dmitri W. Pronkin &amp; Andriy Frolkin, Die Schwalbe 06/1989, 1st Prize, PG in 57.5&quot;]
[FEN &quot;&quot;]

1. a4 h5 2. a5 h4 3. a6 h3 4. axb7 hxg2 5. h4 d5 6. h5 d4 7. h6 d3 8. h7 dxc2 9. d4 a5 10. Bh6 c1=R 11. e4 Rc5 12. Ne2 Rh5 13. e5 c5 14. e6 Nc6 15. b8=R a4 16. Rb4 a3 17. Ra4 c4 18. b4 c3 19. b5 c2 20. b6 c1=R 21. b7 Rc4 22. b8=R Qa5+ 23. Rbb4 Bb7 24. N1c3 O-O-O 25. exf7 e5 26. Rc1 Bc5 27. f8=R a2 28. Rf3 a1=R 29. Na2 g1=R 30. Rfa3 Rg6 31. f4 Re6 32. f5 g5 33. f6 g4 34. f7 g3 35. f8=R g2 36. Rf5 g1=R 37. Bf8 Rg7 38. Ng3 e4 39. Bd3 e3 40. O-O e2 41. Rcc3 e1=R 42. Bc2 R1e3 43. d5 Rdd7 44. d6 Rdf7 45. d7+ Kb8 46. Qd6+ Ka8 47. Qc7 Nge7 48. d8=R+ Nc8 49. Rdd3 Rhg8 50. h8=R Rae1 51. Rh6 R1e2 52. R1f2 Rce4 53. Kf1 Bd4 54. Rfc5 Ne5 55. Nf5 Nc4 56. Nd6 Nb2 57. Rbc4 Nb6 58. Qb8+

What this really means, is that the final position can be reached in 57.5 moves (not less), and that there is only one way to do this. In your example, moves 48 and 49 (and many others) could be switched. Also, currently there is no other position with this characteristic known which takes more moves to obtain.