#include <bits/stdc++.h>
using namespace std;
const int N = 201110;
int s[N], p[N], a[N], f[N];
int n;
void update(int x) {
  for (; x <= n; x += x & -x) s[x]++;
}
int cal(int x) {
  int r = 0;
  for (; x > 0; x -= x & -x) r += s[x];
  return r;
}
void ord(int p[]) {
  for (int i = n; i > 0; i--) {
    p[i]++;
    f[n - i] += cal(p[i] - 1);
    update(p[i]);
  }
}
int Search(int u) {
  int inf = 1, sup = n, res, mid;
  while (inf <= sup) {
    mid = (inf + sup) / 2;
    if (mid - cal(mid) >= u) {
      res = mid;
      sup = mid - 1;
    } else
      inf = mid + 1;
  }
  update(res);
  return res;
}
int main() {
  scanf("%d", &n);
  memset(s, 0, sizeof(s));
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  ord(p);
  memset(s, 0, sizeof(s));
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  ord(p);
  for (int i = 1; i < n; i++)
    if (f[i] > i) {
      f[i] -= (i + 1);
      f[i + 1]++;
    }
  f[n] = 0;
  memset(s, 0, sizeof(s));
  for (int i = 1; i <= n; i++) {
    a[i] = Search(f[n - i] + 1);
  }
  for (int i = 1; i <= n; i++) cout << a[i] - 1 << " ";
}
