#include <bits/stdc++.h>
using namespace std;
int A1[2000100], kkt[2000100], p, A2[2000100], A3[2000100], P[2000100],
    Q[2000100], sol[2000100], n;
void upd(int A[], int poz, int val) {
  for (; poz <= n; poz += poz & -poz) A[poz] += val;
}
int find(int A[], int poz) {
  int sum = 0;
  for (; poz; poz -= poz & -poz) sum += A[poz];
  return sum;
}
int cb(int x) {
  int st = 1;
  int dr = n;
  int best = 0;
  while (st <= dr) {
    int mij = (st + dr) >> 1;
    if (find(A3, mij) >= x) {
      best = mij;
      dr = mij - 1;
    } else
      st = mij + 1;
  }
  return best;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> P[i];
  for (int i = 1; i <= n; ++i) cin >> Q[i];
  for (int i = 1; i <= n; ++i) {
    P[i]++;
    Q[i]++;
  }
  for (int i = 1; i <= n; ++i) {
    upd(A1, i, 1);
    upd(A2, i, 1);
    upd(A3, i, 1);
  }
  for (int i = 1; i <= n; ++i) {
    int a = find(A1, P[i]);
    int b = find(A2, Q[i]);
    upd(A1, P[i], -1);
    upd(A2, Q[i], -1);
    a--;
    b--;
    a += b;
    p = i;
    kkt[i] = a;
    while (kkt[p] >= n - p + 1) {
      kkt[p] -= n - p + 1;
      --p;
      kkt[p]++;
    }
  }
  for (int i = 1; i <= n; ++i) {
    sol[i] = cb(kkt[i] + 1);
    upd(A3, sol[i], -1);
  }
  for (int i = 1; i <= n; ++i) sol[i]--;
  for (int i = 1; i <= n; ++i) cout << sol[i] << " ";
  return 0;
}
