#include <bits/stdc++.h>
using namespace std;
const int maxn = 200010;
int p[maxn];
int q[maxn];
int cp[maxn];
int cq[maxn];
int cc[maxn];
int n;
int sum[maxn];
bool use[maxn];
inline int lowbit(int x) { return x & (-x); }
void update(int pos, int val, int flag) {
  int* c;
  if (flag == 0) c = cq;
  if (flag == 1) c = cp;
  if (flag == 2) c = cc;
  while (pos <= n) {
    c[pos] += val;
    pos += lowbit(pos);
  }
}
int query(int pos, int flag) {
  int* c;
  if (flag == 0) c = cq;
  if (flag == 1) c = cp;
  if (flag == 2) c = cc;
  int re = 0;
  while (pos) {
    re += c[pos];
    pos -= lowbit(pos);
  }
  return re;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
    p[i]++;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &q[i]);
    q[i]++;
  }
  for (int i = 0; i < n; i++) {
    int q_p = (p[i] - 1) - query(p[i], 0);
    int q_q = (q[i] - 1) - query(q[i], 1);
    sum[i] = q_p + q_q;
    update(p[i], 1, 0);
    update(q[i], 1, 1);
  }
  for (int i = n - 1; i >= 0; i--) {
    while (sum[i] >= (n - i)) {
      if (i) sum[i - 1]++;
      sum[i] -= (n - i);
    }
  }
  for (int i = 0; i < n; i++) {
    int res = -1;
    int l = 1, r = n;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (query(mid, 2) + sum[i] + 1 <= mid) {
        r = mid - 1;
        if (query(mid, 2) + sum[i] + 1 == mid) {
          res = mid;
        }
      } else {
        l = mid + 1;
      }
    }
    printf("%d ", res - 1);
    update(res, 1, 2);
  }
  return 0;
}
