#include <bits/stdc++.h>
using namespace std;
const int N = 212345;
int a[N], b[N];
int d[N * 4][2];
int s[N * 4];
void update(int l, int r, int id, int ind, int x) {
  if (l == r) {
    d[id][x]++;
    return;
  }
  int m = (l + r) >> 1;
  if (ind <= m)
    update(l, m, id + id, ind, x);
  else
    update(m + 1, r, id + id + 1, ind, x);
  d[id][x] = d[id + id][x] + d[id + id + 1][x];
}
int sumlr(int l, int r, int id, int ll, int rr, int x) {
  if (ll > rr) return 0;
  if (ll <= l && r <= rr) return d[id][x];
  int m = (l + r) >> 1, s = 0;
  if (ll <= m) s += sumlr(l, m, id + id, ll, rr, x);
  if (rr > m) s += sumlr(m + 1, r, id + id + 1, ll, rr, x);
  return s;
}
void update1(int l, int r, int id, int ind, int x) {
  if (l == r) {
    s[id] += x;
    return;
  }
  int m = (l + r) >> 1;
  if (ind <= m)
    update1(l, m, id + id, ind, x);
  else
    update1(m + 1, r, id + id + 1, ind, x);
  s[id] = s[id + id] + s[id + id + 1];
}
int indsumx(int l, int r, int id, int x) {
  if (l == r) return l;
  int m = (l + r) >> 1;
  if (s[id + id] >= x) {
    return indsumx(l, m, id + id, x);
  } else {
    x -= s[id + id];
    return indsumx(m + 1, r, id + id + 1, x);
  }
}
int w[N];
int ans[N];
int main() {
  int n, m, i, j;
  cin >> n;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]), a[i]++;
  for (i = 1; i <= n; i++) scanf("%d", &b[i]), b[i]++;
  int q = 0;
  for (i = n; i >= 1; i--) {
    int x = sumlr(1, n, 1, 1, a[i], 0) + sumlr(1, n, 1, 1, b[i], 1) + q;
    q = x / (n - i + 1);
    x %= (n - i + 1);
    w[i] = x;
    update(1, n, 1, a[i], 0);
    update(1, n, 1, b[i], 1);
  }
  for (i = 1; i <= n; i++) {
    update1(1, n, 1, i, 1);
  }
  for (i = 1; i <= n; i++) {
    int q = indsumx(1, n, 1, w[i] + 1);
    q--;
    printf("%d ", q);
    update1(1, n, 1, q + 1, -1);
  }
}
