#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int MAXN = 2e5 + 5;
int m;
int bit[MAXN];
int sum(int i) {
  int s = 0;
  while (i > 0) {
    s += bit[i];
    i -= i & -i;
  }
  return s;
}
void add(int i, int first) {
  while (i <= 200000) {
    bit[i] += first;
    i += i & -i;
  }
}
int tt(int s) {
  int ans = 1;
  while (s >= 1) ans *= s, s--;
  return ans;
}
int summ[MAXN], SUM[MAXN];
void calc(int a[]) {
  int i;
  memset(bit, 0, sizeof(bit));
  memset(summ, 0, sizeof(summ));
  for (i = 1; i <= m; i++) add(i, 1);
  for (i = 1; i <= m; i++) {
    summ[m - i] += sum(a[i] - 1);
    add(a[i], -1);
  }
}
int a[MAXN], b[MAXN];
int main() {
  int n, i, j, k;
  scanf("%d", &m);
  for (i = 1; i <= m; i++) scanf("%d", &a[i]), a[i]++;
  for (i = 1; i <= m; i++) scanf("%d", &b[i]), b[i]++;
  calc(a);
  for (i = 1; i <= m; i++) SUM[i] += summ[i];
  calc(b);
  for (i = 1; i <= m; i++) SUM[i] += summ[i];
  for (i = 1; i <= m; i++) {
    SUM[i + 1] += SUM[i] / (i + 1);
    SUM[i] %= (i + 1);
  }
  memset(bit, 0, sizeof(bit));
  for (i = 1; i <= m; i++) add(i, 1);
  for (i = 1; i <= m; i++) {
    int l = 1, r = m, need = SUM[m - i], o = 20;
    j = 0;
    while (o--) {
      int mid = (l + r) >> 1;
      int nn = sum(mid - 1);
      if (nn > need)
        r = mid - 1;
      else {
        l = mid + 1;
        j = max(j, mid);
      }
    }
    printf("%d ", j - 1);
    add(j, -1);
  }
  printf("\n");
}
