#include <iostream> #include <vector> using namespace std; void swap(vector<int> &arr, int p1, int p2) { int tmp = arr[p1]; arr[p1] = arr[p2]; arr[p2] = tmp; } int main() { int N; cin >> N; vector<int> arr(N); for(int i = 0; i < N; i++) cin >> arr[i]; // 排序 int p = 0; for(int i = 0; i < N; i++) { if (arr[i] != i + 1) { swap(arr, i, arr[i]-1); i--; } } for(int i = 0; i < N; i++) cout << arr[i] << " "; return 0; }