#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 20;
int a[N], b[N], c[N], fac[N];
int lowbit(int x) { return x & (-x); }
void add(int x, int y) {
  for (x; x < N; x += lowbit(x)) c[x] += y;
}
int query(int x) {
  int ans = 0;
  for (x; x > 0; x -= lowbit(x)) ans += c[x];
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    a[i]++;
  }
  for (int i = n - 1; i >= 0; i--) {
    fac[n - i - 1] = query(a[i]);
    add(a[i], 1);
  }
  memset(c, 0, sizeof(c));
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
    b[i]++;
  }
  for (int i = n - 1; i >= 0; i--) {
    fac[n - i - 1] += query(b[i]);
    add(b[i], 1);
  }
  for (int i = 1; i < n; i++) {
    if (fac[i] >= (i + 1)) {
      fac[i + 1]++;
      fac[i] -= (i + 1);
    }
  }
  memset(c, 0, sizeof(c));
  for (int i = 1; i <= n; i++) add(i, 1);
  int tot = 0;
  bool visit[200010];
  memset(visit, 0, sizeof(visit));
  for (int i = n - 1; i; i--) {
    int left = 1, right = n, found;
    while (left <= right) {
      int mid = left + right >> 1;
      if (query(mid) >= fac[i] + 1)
        found = mid, right = mid - 1;
      else
        left = mid + 1;
    }
    tot++;
    printf("%d ", found - 1);
    add(found, -1);
    visit[found] = 1;
  }
  for (int i = 1; i <= n; i++)
    if (!visit[i]) printf("%d\n", i - 1);
  return 0;
}
