#include <bits/stdc++.h>
using namespace std;
int n;
int a[200005], b[200005];
int it[200005], it2[200005], perm1[200005], perm2[200005], perm[200005];
void update(int u, int val) {
  while (u <= n) {
    it[u] += val;
    u += u & (-u);
  }
}
int get(int u) {
  int kq = 0;
  while (u) {
    kq += it[u];
    u &= (u - 1);
  }
  return kq;
}
int kq[200005];
void doc() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], ++a[i];
  for (int i = 1; i <= n; i++) cin >> b[i], ++b[i];
  for (int i = 1; i <= n; i++) update(i, 1);
  for (int i = 1; i <= n; i++) {
    int u = a[i];
    perm1[i] = get(u - 1);
    update(u, -1);
  }
  for (int i = 1; i <= n; i++) update(i, 1);
  for (int i = 1; i <= n; i++) {
    int u = b[i];
    perm2[i] = get(u - 1);
    update(u, -1);
  }
  int nho = 0, r;
  for (int i = 1; i <= n; i++) {
    int u = perm1[n - i + 1], v = perm2[n - i + 1];
    r = u + v + nho;
    nho = r / (i);
    perm[i] = r % (i);
  }
  for (int i = 1; i <= n; i++) update(i, 1);
  for (int i = n; i >= 1; i--) {
    int u = perm[i] + 1;
    int lo = 0, hi = n + 1;
    while (hi - lo > 1) {
      int mid = (lo + hi) / 2;
      if (get(mid) < u)
        lo = mid;
      else
        hi = mid;
    }
    kq[i] = hi;
    update(hi, -1);
  }
  for (int i = n; i >= 1; i--) cout << kq[i] - 1 << " ";
}
int main() { doc(); }
