#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n;
int a[N], b[N];
int u[N];
void modify(int x, int w) {
  for (; x <= n; x += x & (-x)) u[x] += w;
}
int getsum(int x) {
  int res = 0;
  for (; x; x -= x & (-x)) res += u[x];
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    a[i]++;
  }
  for (int i = n; i > 0; --i) {
    b[i] = getsum(a[i]);
    modify(a[i], 1);
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    a[i]++;
  }
  memset(u, 0, sizeof(u));
  for (int i = n; i > 0; --i) {
    b[i] += getsum(a[i]);
    modify(a[i], 1);
  }
  for (int i = n; i > 0; --i) {
    b[i - 1] += b[i] / (n - i + 1);
    b[i] %= n - i + 1;
  }
  memset(u, 0, sizeof(u));
  for (int i = 1; i <= n; ++i) {
    modify(i, 1);
  }
  for (int i = 1; i <= n; ++i) {
    int l = 1, r = n;
    while (l < r) {
      int mid = (l + r) / 2;
      if (getsum(mid) > b[i])
        r = mid;
      else
        l = mid + 1;
    }
    modify(l, -1);
    printf("%d%c", l - 1, " \n"[i == n]);
  }
  return 0;
}
