#include <bits/stdc++.h>
using namespace std;
const int M = 23e4 + 5;
int sum[M], n, fen[M];
int main() {
  scanf("%d", &n);
  int t = 2;
  while (t--) {
    memset(fen, 0, sizeof fen);
    for (int i = 0; i < n; i++) {
      int p;
      scanf("%d", &p);
      int k = p, u = p, ans = 0;
      for (; p > 0; p -= p & -p) ans += fen[p];
      for (u++; u < M; u += u & -u) fen[u]++;
      sum[i] += k - ans;
    }
  }
  int sb = 0;
  for (int i = n - 1; ~i; i--) {
    sum[i] += sb;
    int k = sum[i] % (n - i);
    sb = (sum[i] - k) / (n - i);
    sum[i] = k;
  }
  for (int i = 1; i < M; i++) fen[i] = i & -i;
  for (int i = 0; i < n; i++) {
    int p = sum[i];
    int cur = 0;
    for (int i = 17; ~i; i--) {
      int d = cur + (1 << i);
      if (fen[d] <= p) p -= fen[d], cur = d;
    }
    int u = cur;
    for (u++; u < M; u += u & -u) fen[u]--;
    printf("%d ", cur);
  }
  return printf("\n"), 0;
}
