#include <bits/stdc++.h>
using namespace std;
int n, xx[524288 + 1], yy[524288 + 1], p[524288 + 1], q[524288 + 1],
    fuck[524288 + 1];
int Ask(int t) {
  int ck = t + 1, res = 0;
  while (t) {
    res += yy[t];
    t -= ((t) & (-(t)));
  }
  res += xx[0];
  return ck - res;
}
void Add(int t) {
  xx[t]++;
  if (t != 0)
    while (t <= 524288) {
      yy[t]++;
      t += ((t) & (-(t)));
    }
}
int find(int t) {
  int l = 0, r = n;
  while (r - l > 2) {
    int mid = l + r >> 1;
    if (Ask(mid) >= t)
      r = mid;
    else
      l = mid;
  }
  for (int i = l; i <= r; i++)
    if (Ask(i) == t) return i;
}
void Work(int *c) {
  for (int i = 0; i <= 524288; i++) xx[i] = yy[i] = 0;
  for (int i = 1; i <= n; i++) {
    int s = Ask(c[i]) - 1;
    fuck[i] += s;
    Add(c[i]);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", p + i);
  for (int i = 1; i <= n; i++) scanf("%d", q + i);
  Work(p);
  Work(q);
  for (int i = 0; i <= 524288; i++) yy[i] = xx[i] = 0;
  for (int i = n; i >= 1; i--) {
    fuck[i - 1] += fuck[i] / (n - i + 1);
    fuck[i] %= (n - i + 1);
  }
  for (int i = 1; i <= n; i++) {
    int s = fuck[i] + 1;
    int t = find(s);
    printf("%d ", t);
    Add(t);
  }
  return 0;
}
