# [R], <s>58</s> 55 bytes

<!-- language-all: lang-r -->

    b=seq(a<-scan());while(any(b-a))a=matrix(a,,2,F<-F+1);F

[Try it online!][TIO-jt5q92ne]

[R]: https://www.r-project.org/
[TIO-jt5q92ne]: https://tio.run/##nZTBbtswEETv/QoBuUgoDXCXpEQhybH@DyWIWwOJgzgO2qLot7tvZDtBeqlTHyXP7PDNUtv9qrlaNKuXze1u/bhp113zq3m@nTbvnnbr5uLLw8v9tFtvvh5erx63ze7uWQ/2N9fPd0/tdLXQm7brLr9/W9/ftdPmZ3uzmLpuun6Ydtv1j3YKwcPyarH8bN3lcv/706q9bY1nqesumo/@4ps85FA@anGSp@D/M92O8p75AyaVDGMoweJZbvY6vSB3xP1HUvhRXpmfkY@YFMzOnH6SjxgMWBRM4HCuPB3lBYOMRZqP0J8rz@/OPh5OH@q55y@v5M1m4DN5NUAT/zbpj3J0NiK0itIGklgvzyLPjKclAXVhYclOR7P4V3pe8k9keNjrYWZ7lxGujHjTD6f5GQ/@MUAO9jGFkSYTAi@zqFAtlpVo6E2W2Gcm5hgSBgMMiBepH4OksHkOUuhTU/swUIxyRRwyDglQBBti6HUmNgADpfA0Zy0cHIPK0VhspYg4KEbCgdH9GPqIMoYRA6VwP5yfS4hBzWEoKNULDoqRcGB0X0PBYIQ5BkrhNiMqIMOgskUAUIqIg2IkHFQLu43BSFEAUAqPM/ZiIWNQ6R0AShFxUIyEA6N7VlutDKESXyloSM0UlgaDagH8rhTwd8WggJk/a4DBSJXEVwoKEHo2Hn2NAfquEOB3pUgyQMinCP1YAvhdIeDPYOgD3wZuKsdXBui7QiRVgJCFQs8SQN@VAfzMBX7SgnLVOX1UfgwUAvqCzw4A39gB4LsyQJ@5sAe9sQK99o/46JUhKQA6bg9yNgD0rgiw1@7zIUHOAgDe6R/wrgiu@ehiALzRP@BdCUwfYIN70i1gOCenfbC7Eog7Y2m/6M7FUBUcC9On26Curad8oDvdA92VQNSR0r2Wnu6h7nP1@ugb0LXzVA9zp3mYuxIIOlKa18rTPNBdCaDuRRcxl/0f "R – Try It Online"

Simulates the sorting process. Input is 1-indexed, returns `FALSE` for 0.