#define _USE_MATH_DEFINES #include <iostream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <array> #include <list> #include <queue> #include <vector> #include <complex> #include <set> #include <map> ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)<<endl; #define PII pair<int,int> ///////// typedef long long LL; typedef long double LD; ///////// using namespace::std; ///////// int main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;// cout << setprecision(10);// bool b[50][50]; int N; cin>>N; rep(i,N)rep(j,N){ b[i][j] = false; } int A[50]; int bb[50]; rep(i,50)bb[i]=0; rep(i,N){ cin>>A[i]; b[i][A[i]] = true; ++bb[A[i]]; } bool used[50]; bool usedNo[50]; rep(i,N){ used[i]=false; usedNo[i] = false; } ////////// int ans[50]; rep(i,N)ans[i]=-1; int max=0; int maxNo; int nokori = N; for(int count=0;count<N;++count) { max = 0; maxNo = -1; rep(i,N){ if(max < bb[i] ){ max = bb[i]; maxNo = i; } } if( max == nokori){ P(-1); return 0; } --nokori; if(max == 0){ rep(i,N){ if(used[i] == false){ rep(k,N){ if(usedNo[k] == false){ ans[i] = k; used[i] = true; usedNo[k] = true; break; } } } } break; } else if(max == 1){ rep(i,N){ if( ans[i] == -1){ rep(k,N){ if( usedNo[((A[i]+k+1)%N)] == false){ ans[i] = ((A[i]+k+1)%N); usedNo[((A[i]+k+1)%N)] = true; used[i] = true; break; } } } } break; } else{ bb[maxNo] = 0; rep(i,N){ if(b[i][maxNo] == false && used[i] == false){ used[i] = true; usedNo[maxNo] = true; ans[i] = maxNo; break; } } } } rep(i,N){ P(ans[i]); } return 0; }