#include <bits/stdc++.h>
using namespace std;
int n;
int nn;
int at(int x) { return x / nn; }
vector<vector<int> > G;
void intialize() {
  G.assign(nn, vector<int>());
  for (int i = 0; i < n; ++i) G[at(i)].push_back(i);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  nn = ceil(sqrt(n));
  vector<int> p(n), q(n), P(n, 0), Q(n, 0);
  for (int i = 0; i < n; ++i) cin >> p[i];
  for (int i = 0; i < n; ++i) cin >> q[i];
  intialize();
  for (int i = 0; i < n; ++i) {
    int k = 0;
    while (G[k].empty() || G[k].back() < p[i]) P[i] += G[k++].size();
    for (int j = 0; j < G[k].size(); ++j)
      if (G[k][j] == p[i]) {
        P[i] += j;
        G[k].erase(G[k].begin() + j);
        break;
      }
  }
  intialize();
  for (int i = 0; i < n; ++i) {
    int k = 0;
    while (G[k].empty() || G[k].back() < q[i]) Q[i] += G[k++].size();
    for (int j = 0; j < G[k].size(); ++j)
      if (G[k][j] == q[i]) {
        Q[i] += j;
        G[k].erase(G[k].begin() + j);
        break;
      }
  }
  int rem = 0;
  vector<int> s(n, 0);
  for (int i = n - 1; i >= 0; --i) {
    s[i] = P[i] + Q[i] + rem;
    if (s[i] >= n - i)
      rem = 1;
    else
      rem = 0;
    s[i] %= n - i;
  }
  intialize();
  for (int i = 0; i < n; ++i) {
    int k = 0, N = s[i];
    while (N >= G[k].size()) {
      N -= G[k].size();
      k++;
    }
    cout << G[k][N] << ' ';
    G[k].erase(G[k].begin() + N);
  }
  cout << "\n";
}
