#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAXN = 200010;
class Fenwick {
 private:
  int sz;
  int* T;

 public:
  Fenwick(int n) {
    sz = n;
    T = new int[sz];
    for (int i = 0; i < sz; ++i) T[i] = 0;
  }
  void init() {
    for (int i = 0; i < sz; ++i) {
      add(i, 1);
    }
  }
  void add(int i, int a) {
    for (; i < sz; i = (i | (i + 1))) {
      T[i] += a;
    }
  }
  int get(int r) {
    int res = 0;
    for (; r >= 0; r = (r & (r + 1)) - 1) {
      res += T[r];
    }
    return res;
  }
};
int n;
int p[MAXN], q[MAXN], res[MAXN];
Fenwick *Fp, *Fq, *F;
void gen(int pos, int carry) {
  if (pos == -1) {
    return;
  }
  int len = n - pos;
  int cur = Fp->get(p[pos]) + Fq->get(q[pos]) + carry;
  Fp->add(p[pos], 1);
  Fq->add(q[pos], 1);
  res[pos] = cur % len;
  gen(pos - 1, cur / len);
}
int get(int pos) {
  int l = pos - 1, r = n - 1;
  while (l < r - 1) {
    int mid = (l + r) >> 1;
    if (F->get(mid) < pos) {
      l = mid;
    } else {
      r = mid;
    }
  }
  if (F->get(l) == pos) {
    return l;
  }
  return r;
}
void repl(int pos) {
  if (pos == n) {
    return;
  }
  res[pos] = get(res[pos] + 1);
  F->add(res[pos], -1);
  repl(pos + 1);
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> q[i];
  }
  Fp = new Fenwick(n);
  Fq = new Fenwick(n);
  gen(n - 1, 0);
  F = new Fenwick(n);
  F->init();
  repl(0);
  for (int i = 0; i < n; ++i) {
    cout << res[i] << " ";
  }
  return 0;
}
