#include using namespace std; #define WHY_NOT_AC ios::sync_with_stdio(0), cin.tie(0), cout.tie(0) // #define WHY_NOT_AC ios::sync_with_stdio(0), cin.tie(0) #define ULL unsigned long long #define int long long #define endl "\n" #define DB double #define LL long long int n; vector hatenum, number; int frandom(int l, int r) { mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<> dis(l, r); return dis(mt); } void fshuffle() { mt19937 mt(chrono::steady_clock::now().time_since_epoch().count()); shuffle(number.begin(), number.end(), mt); } bool check() { for (int i = 0; i < n; i++) { if (hatenum[i] == number[i]) return false; } return true; } signed main() { cin >> n; hatenum.resize(n); number.resize(n); for (int i = 0; i < n; i++) { cin >> hatenum[i]; number[i] = i; } int times = 20; while (times--) { if (check()) { for (int i : number) cout << i << endl; return 0; } fshuffle(); } cout << -1 << endl; return 0; }