#include <bits/stdc++.h>
using namespace std;
inline char get() {
  static char buf[100000], *S = buf, *T = buf;
  if (S == T) {
    T = (S = buf) + fread(buf, 1, 100000, stdin);
    if (S == T) return EOF;
  }
  return *S++;
}
inline void read(int& x) {
  static char c;
  x = 0;
  int sgn = 1;
  for (c = get(); c < '0' || c > '9'; c = get())
    if (c == '-') sgn = -1;
  for (; c >= '0' && c <= '9'; c = get()) x = c - '0' + x * 10;
  x *= sgn;
}
struct segtree {
  vector<int> t;
  int n, h;
  segtree(int sz) {
    h = sizeof(int) * 8 - __builtin_clz(sz - 1);
    n = 1 << h;
    t = vector<int>(n << 1, 0);
  }
  segtree(int sz, bool f) {
    h = sizeof(int) * 8 - __builtin_clz(sz - 1);
    n = 1 << h;
    t = vector<int>(n << 1, 0);
    for (int i = 0; i < sz; ++i) t[i + n] = 1;
    for (int i = n - 1; i > 0; --i) t[i] = t[i << 1] + t[i << 1 | 1];
  }
  void add(int i, int v) {
    for (i += n; i > 0; i /= 2) t[i] += v;
  }
  int query(int l, int r) {
    int v = 0;
    for (l += n, r += n; l < r; l /= 2, r /= 2) {
      if (l % 2) {
        v += t[l++];
      }
      if (r % 2) {
        v += t[--r];
      }
    }
    return v;
  }
  int find(int v) {
    int s = 1;
    int base = 0;
    while (s < n) {
      s *= 2;
      if (t[s] + base <= v) base += t[s++];
    }
    return s - n;
  }
};
void fillNum(vector<int>& p, vector<int>& nump, segtree& st, const int N) {
  st.add(p[N - 1], 1);
  for (int i = 0; i < N - 1; ++i) {
    nump[i] = st.query(0, p[N - 2 - i]);
    st.add(p[N - 2 - i], 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int N;
  cin >> N;
  vector<int> p(N), q(N), nump(N, 0), numq(N, 0);
  for (int& ii : p) cin >> ii;
  for (int& ii : q) cin >> ii;
  segtree ps(N), qs(N), resurrect(N, true);
  fillNum(p, nump, ps, N);
  fillNum(q, numq, qs, N);
  int rem = 0;
  for (int i = 0; i < N - 1; ++i) {
    nump[i] += rem + numq[i];
    rem = nump[i] / (i + 2);
    nump[i] %= (i + 2);
  }
  for (int i = N - 2; i >= 0; --i) {
    int v = resurrect.find(nump[i]);
    cout << v << " ";
    resurrect.add(v, -1);
  }
  cout << resurrect.find(0) << endl;
  return 0;
}
