#include <bits/stdc++.h>
using namespace std;
const int64_t N = 1e6 + 6, M = 1e9 + 7;
struct node {
  int64_t a;
};
int64_t n;
vector<node> t;
node combine(node l, node r) {
  node res;
  res.a = l.a + r.a;
  return res;
}
void modify(int p, node value) {
  for (t[p += n] = value; p >>= 1;) t[p] = combine(t[p << 1], t[p << 1 | 1]);
}
void build() {
  for (int64_t i = n - 1; i > 0; --i) t[i] = combine(t[i << 1], t[i << 1 | 1]);
}
node query(int64_t l, int64_t r) {
  node resl, resr;
  resl.a = resr.a = 0;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l & 1) resl = combine(resl, t[l++]);
    if (r & 1) resr = combine(t[--r], resr);
  }
  return combine(resl, resr);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  cin >> n;
  vector<int64_t> a(n), b(n), f(n);
  for (int64_t &e : a) cin >> e;
  for (int64_t &e : b) cin >> e;
  t.clear();
  t.resize(2 * N);
  for (int64_t i = 0; i < n; i++) t[n + i].a = 1;
  build();
  for (int64_t i = 0; i < n; i++) f[i] += query(0, a[i]).a, modify(a[i], {0});
  t.clear();
  t.resize(2 * N);
  for (int64_t i = 0; i < n; i++) t[n + i].a = 1;
  build();
  for (int64_t i = 0; i < n; i++) f[i] += query(0, b[i]).a, modify(b[i], {0});
  for (int64_t i = n - 1; i >= 0; i--) {
    int64_t mod = n - i;
    if (f[i] >= mod) {
      f[i] -= mod;
      if (i) f[i - 1]++;
    }
  }
  t.clear();
  t.resize(2 * N);
  for (int64_t i = 0; i < n; i++) t[n + i].a = 1;
  build();
  for (int64_t i = 0; i < n; i++) {
    int64_t l = 0, h = n;
    while (l < h) {
      int mid = l + (h - l) / 2;
      int64_t x = query(0, mid).a;
      if (f[i] >= x)
        l = mid + 1;
      else
        h = mid;
    }
    l--;
    modify(l, {0});
    cout << l << ' ';
  }
}
