#include <bits/stdc++.h>
using namespace std;
int c[300005], a[300005], b[300005];
int n;
int sum(int x) {
  int ret = 0;
  while (x > 0) {
    ret += c[x];
    x -= (x & -x);
  }
  return ret;
}
void add(int x, int d) {
  while (x <= n) {
    c[x] += d;
    x += (x & -x);
  }
}
void cal() {
  int i;
  memset(c, 0, sizeof(c));
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i]++;
  }
  for (i = n; i >= 1; i--) {
    b[i] = b[i] + sum(a[i]);
    add(a[i], 1);
  }
}
int main() {
  int i, l, r, mid;
  memset(b, 0, sizeof(b));
  scanf("%d", &n);
  cal();
  cal();
  memset(c, 0, sizeof(c));
  for (i = n; i >= 1; i--) {
    b[i - 1] = b[i - 1] + b[i] / (n - i + 1);
    b[i] = b[i] % (n - i + 1);
  }
  for (i = 1; i <= n; i++) add(i, 1);
  for (i = 1; i <= n; i++) {
    l = 1;
    r = n;
    while (l < r) {
      mid = l + (r - l) / 2;
      if (sum(mid) <= b[i])
        l = mid + 1;
      else
        r = mid;
    }
    add(l, -1);
    printf("%d", l - 1);
    if (i == n)
      printf("\n");
    else
      printf(" ");
  }
  return 0;
}
