#include <bits/stdc++.h>
using std::memset;
using std::printf;
using std::scanf;
constexpr int maxn = 200010;
int rec[maxn];
int end[maxn];
int treeset[maxn];
int now[maxn];
int n;
inline int lowbit(int x) { return x & (-x); }
void add(int x, int d) {
  ++x;
  while (x <= n) {
    treeset[x] += d;
    x += lowbit(x);
  }
}
int sum(int x) {
  ++x;
  int ans = 0;
  while (x) {
    ans += treeset[x];
    x -= lowbit(x);
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", rec + i);
  }
  for (int i = 0; i < n; ++i) {
    add(i, 1);
  }
  for (int i = 0; i < n; ++i) {
    now[i] = sum(rec[i] - 1);
    add(rec[i], -1);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", rec + i);
  }
  memset(treeset, 0, sizeof(treeset));
  for (int i = 0; i < n; ++i) {
    add(i, 1);
  }
  for (int i = 0; i < n; ++i) {
    now[i] += sum(rec[i] - 1);
    add(rec[i], -1);
  }
  memset(treeset, 0, sizeof(treeset));
  for (int i = 0; i < n; ++i) {
    add(i, 1);
  }
  for (int i = n - 1; i; --i) {
    now[i - 1] += now[i] / (n - i);
    now[i] %= (n - i);
  }
  now[0] %= n;
  for (int i = 0; i < n; ++i) {
    int right = n - 1;
    int left = 0;
    while (left < right) {
      int mid = (left + right + 1) >> 1;
      if (sum(mid - 1) <= now[i]) {
        left = mid;
      } else {
        right = mid - 1;
      }
    }
    add(left, -1);
    end[i] = left;
  }
  for (int i = 0; i < n - 1; ++i) {
    printf("%d ", end[i]);
  }
  printf("%d\n", end[n - 1]);
}
