#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int *p = new int[n + 1];
  int *q = new int[n + 1];
  int *sum = new int[n + 1];
  int *plabel = new int[n + 1];
  int *qlabel = new int[n + 1];
  int *alabel = new int[n + 1];
  int *result = new int[n + 1];
  map<int, int> pmap;
  map<int, int> qmap;
  for (int i = 1; i <= n; i++) {
    pmap[i] = i;
    qmap[i] = i;
  }
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> q[i];
  }
  for (int i = 1; i <= n; i++) {
    plabel[i] = qlabel[i] = alabel[i] = 0;
  }
  int pvalue, qvalue;
  for (int i = 0; i < n; i++) {
    pvalue = p[i] + 1;
    int sump = 0;
    for (int j = pvalue; j > 0; j -= j & (-j)) sump += plabel[j];
    pmap[pvalue] -= sump;
    for (int j = pvalue; j <= n; j += j & (-j)) plabel[j] += 1;
    qvalue = q[i] + 1;
    int sumq = 0;
    for (int j = qvalue; j > 0; j -= j & (-j)) sumq += qlabel[j];
    qmap[qvalue] -= sumq;
    for (int j = qvalue; j <= n; j += j & (-j)) qlabel[j] += 1;
    sum[i] = pmap[pvalue] + qmap[qvalue] - 2;
  }
  int index = 2;
  for (int i = n - 2; i >= 0; i--) {
    if (sum[i] >= index) {
      if (i - 1 >= 0) {
        sum[i - 1] += 1;
      }
      sum[i] %= index;
    }
    index++;
  }
  map<int, int> amap;
  for (int i = 1; i <= n; i++) amap[i] = i;
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j += j & (-j)) alabel[j] += 1;
  int left, right, mid;
  for (int i = 0; i < n; i++) {
    left = 1;
    right = n;
    while (left <= right) {
      mid = (left + right) / 2;
      int suma = 0;
      for (int j = mid; j > 0; j -= j & (-j)) suma += alabel[j];
      if (suma > sum[i] + 1)
        right = mid - 1;
      else
        left = mid + 1;
    }
    for (int j = left; j <= n; j += j & (-j)) alabel[j] += -1;
    result[i] = left - 1;
  }
  for (int i = 0; i < n; i++) {
    cout << result[i] - 1 << " ";
  }
  return 0;
}
