#include <bits/stdc++.h>
using namespace std;
int p[2][200003];
int pos[200003];
int tr[3][800000];
void build(int k, int l, int r) {
  if (l == r) {
    tr[2][k] = 1;
    return;
  }
  int mid = (l + r) / 2;
  build(2 * k, l, mid);
  build(2 * k + 1, mid + 1, r);
  tr[2][k] = tr[2][2 * k] + tr[2][2 * k + 1];
}
void update(int no, int k, int l, int r, int pp, int x) {
  if (l == r) {
    if (l == pp) tr[no][k] = x;
    return;
  }
  int mid = (l + r) / 2;
  if (pp <= mid) update(no, 2 * k, l, mid, pp, x);
  if (pp > mid) update(no, 2 * k + 1, mid + 1, r, pp, x);
  tr[no][k] = tr[no][2 * k] + tr[no][2 * k + 1];
}
int q1(int no, int k, int l, int r, int r0) {
  if (r0 == 1) return 0;
  if (r < r0) return tr[no][k];
  if (l == r) return 0;
  int mid = (l + r) / 2;
  int res = q1(no, 2 * k, l, mid, r0);
  if (r0 > mid + 1) res += q1(no, 2 * k + 1, mid + 1, r, r0);
  return res;
}
int q2(int k, int l, int r, int num) {
  if (l == r) return l;
  int mid = (l + r) / 2;
  if (tr[2][2 * k] >= num)
    return q2(2 * k, l, mid, num);
  else
    return q2(2 * k + 1, mid + 1, r, num - tr[2][2 * k]);
}
int main() {
  int n;
  scanf("%d", &n);
  if (n == 1) {
    printf("0");
    return 0;
  }
  for (int k = 0; k <= 1; k++)
    for (int i = 1; i <= n; i++) {
      int x;
      scanf("%d", &x);
      p[k][i] = x + 1;
    }
  memset(tr[0], 0, sizeof(tr[0]));
  memset(tr[1], 0, sizeof(tr[1]));
  memset(pos, 0, sizeof(pos));
  build(1, 1, n);
  for (int i = n; i >= 1; i--) {
    pos[i] += q1(0, 1, 1, n, p[0][i]);
    pos[i] += q1(1, 1, 1, n, p[1][i]);
    update(0, 1, 1, n, p[0][i], 1);
    update(1, 1, 1, n, p[1][i], 1);
    if (pos[i] > n - i) {
      pos[i - 1] = pos[i] / (n - i + 1);
      pos[i] = pos[i] % (n - i + 1);
    }
  }
  for (int i = 1; i <= n; i++) {
    int now = q2(1, 1, n, pos[i] + 1);
    update(2, 1, 1, n, now, 0);
    printf("%d", now - 1);
    if (i < n) printf(" ");
  }
  return 0;
}
