#include <bits/stdc++.h>
using namespace std;
void update(vector<int> &fenwick, int index, int value) {
  ++index;
  while (index < fenwick.size()) {
    fenwick[index] += value;
    index += index & -index;
  }
}
int read(vector<int> &fenwick, int index) {
  ++index;
  int sum = 0;
  while (index > 0) {
    sum += fenwick[index];
    index -= index & -index;
  }
  return sum;
}
int main() {
  int n;
  cin >> n;
  vector<int> factorialCount(n);
  auto findPos = [&](vector<int> &v) {
    vector<int> fenwick(1 + n);
    for (int i = 0; i < n; ++i) {
      update(fenwick, v[i], 1);
      int free = v[i] + 1 - read(fenwick, v[i]);
      factorialCount[n - i - 1] += free;
    }
  };
  vector<int> p(n), q(n);
  for (int i = 0; i < n; ++i) cin >> p[i];
  for (int i = 0; i < n; ++i) cin >> q[i];
  findPos(p);
  findPos(q);
  for (int i = 0; i < n; ++i) {
    int cnt = factorialCount[i] / (i + 1);
    if (i + 1 < n) factorialCount[i + 1] += cnt;
    factorialCount[i] -= cnt * (i + 1);
  }
  vector<int> fenwick(1 + n);
  for (int i = 0; i < n; ++i) {
    int needFree = factorialCount[n - 1 - i] + 1;
    int left = -1, right = n - 1;
    while (right - left > 1) {
      int mid = (left + right) / 2;
      int free = mid + 1 - read(fenwick, mid);
      if (free >= needFree)
        right = mid;
      else
        left = mid;
    }
    update(fenwick, right, 1);
    cout << right << ' ';
  }
  cout << endl;
}
