#include <bits/stdc++.h>
using namespace std;
int n, l, r, ans, k = 1, a[200005], b[200005], c[2000005], f[2000005];
int lowbit(int x) { return x & (-x); }
void add(int i, int x) {
  for (; i <= n; i += lowbit(i)) c[i] += x;
}
int ask(int i) {
  int sum = 0;
  for (; i > 0; i -= lowbit(i)) sum += c[i];
  return sum;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), a[i]++;
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]), b[i]++;
  for (int i = 1; i <= n; i++) add(i, 1);
  for (int i = 1; i < n; i++) {
    f[n - i] += ask(a[i] - 1);
    add(a[i], -1);
  }
  memset(c, 0, sizeof(c));
  for (int i = 1; i <= n; i++) add(i, 1);
  for (int i = 1; i < n; i++) {
    f[n - i] += ask(b[i] - 1);
    add(b[i], -1);
  }
  for (int i = 1; i < n; i++) f[i + 1] += f[i] / (i + 1), f[i] %= i + 1;
  memset(c, 0, sizeof(c));
  for (int i = 1; i <= n; i++) add(i, 1);
  for (int i = n - 1; i > 0; i--) {
    l = 1, r = n, ans = -1;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (ask(mid - 1) <= f[i])
        l = mid + 1, ans = mid;
      else
        r = mid - 1;
    }
    if (ans == -1) ans = k;
    add(ans, -1);
    while (!c[k]) k++;
    printf("%d ", ans - 1);
  }
  for (int i = 1; i <= n; i++) {
    if (c[i]) {
      printf("%d", i - 1);
      break;
    }
  }
}
