#include <bits/stdc++.h>
using namespace std;
int const N = 3e5;
int n, p1[N], p2[N], p3[N], num1[N], num2[N], F[N][2], T[N * 4];
void buildT(int v, int tl, int tr) {
  if (tl == tr) {
    T[v] = 1;
  } else {
    int tm = (tl + tr) / 2;
    buildT(v * 2, tl, tm);
    buildT(v * 2 + 1, tm + 1, tr);
    T[v] = T[v * 2] + T[v * 2 + 1];
  }
}
void updT(int v, int tl, int tr, int p) {
  if (tl == tr) {
    T[v] = 0;
  } else {
    int tm = (tl + tr) / 2;
    if (tm >= p)
      updT(v * 2, tl, tm, p);
    else
      updT(v * 2 + 1, tm + 1, tr, p);
    T[v] = T[v * 2] + T[v * 2 + 1];
  }
}
int getT(int v, int tl, int tr, int k) {
  if (tl == tr) {
    return tl;
  } else {
    int tm = (tl + tr) / 2;
    if (T[v * 2] >= k)
      return getT(v * 2, tl, tm, k);
    else
      return getT(v * 2 + 1, tm + 1, tr, k - T[v * 2]);
  }
}
void upd(int x, int t) {
  while (x < n) {
    ++F[x][t];
    x |= (x + 1);
  }
}
int get(int x, int t) {
  int r = 0;
  while (x >= 0) {
    r += F[x][t];
    x = (x & (x + 1)) - 1;
  }
  return r;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &p1[i]);
  for (int i = 0; i < n; ++i) scanf("%d", &p2[i]);
  for (int i = 0; i < n; ++i) {
    num1[i] = p1[i] - get(p1[i], 0);
    upd(p1[i] + 1, 0);
    num2[i] = p2[i] - get(p2[i], 1);
    upd(p2[i] + 1, 1);
  }
  for (int i = n - 1; i >= 0; --i) {
    num1[i] += num2[i];
    if (i) num1[i - 1] += num1[i] / (n - i);
    num1[i] %= (n - i);
  }
  buildT(1, 0, n - 1);
  for (int i = 0; i < n; ++i) {
    int need = num1[i] + 1;
    int val = getT(1, 0, n - 1, need);
    p3[i] = val;
    updT(1, 0, n - 1, val);
  }
  for (int i = 0; i < n; ++i) printf("%d ", p3[i]);
  return 0;
}
