#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct Pt {
  T x, y;
  void scan() { cin >> x >> y; }
};
template <typename T>
inline T sqr(const T& a) {
  return a * a;
}
template <typename T>
inline int sign(const T& a) {
  return a < 0 ? -1 : a > 0;
}
void task();
int main() {
  task();
  return 0;
}
struct SegTree {
  vector<int> t;
  SegTree() { t.resize(8e5 + 10, 0); }
  void update(int v) { t[v] = t[2 * v] + t[2 * v + 1]; }
  void set_val(int v, int tl, int tr, int pos) {
    if (tl > tr) return;
    if (tl == tr) {
      t[v] = 1;
      return;
    }
    int mid = (tl + tr) / 2;
    if (pos <= mid)
      set_val(2 * v, tl, mid, pos);
    else
      set_val(2 * v + 1, mid + 1, tr, pos);
    update(v);
  }
  int get_sum(int v, int tl, int tr, int l, int r) {
    if (tl > tr || l > r) return 0;
    if (tl == l && tr == r) return t[v];
    int mid = (tl + tr) / 2;
    return get_sum(2 * v, tl, mid, l, min(mid, r)) +
           get_sum(2 * v + 1, mid + 1, tr, max(l, mid + 1), r);
  }
  int get_kth(int v, int tl, int tr, int k) {
    if (tl > tr) return -1;
    if (tl == tr) return tl;
    int mid = (tl + tr) / 2;
    int sl = t[2 * v];
    int sr = t[2 * v + 1];
    int rl = mid - tl + 1 - sl;
    if (k <= rl)
      return get_kth(2 * v, tl, mid, k);
    else
      return get_kth(2 * v + 1, mid + 1, tr, k - rl);
  }
};
int n;
int a[int(2e5) + 10];
int f[int(2e5) + 10];
void push(int* a) {
  SegTree t;
  for (int i = 0; i < n; ++i)
    f[n - i - 1] += a[i] - t.get_sum(1, 0, n, 0, a[i]),
        t.set_val(1, 0, n, a[i]);
  for (int i = 1; i < n; ++i) {
    f[i + 1] += f[i] / (i + 1);
    f[i] %= i + 1;
  }
}
void build_ans(int* a) {
  SegTree t;
  for (int i = 0, f_id = n - 1; i < n; ++i, --f_id) {
    int pw = f[f_id];
    pw %= f_id + 1;
    (void(1));
    a[i] = t.get_kth(1, 0, n, pw + 1);
    t.set_val(1, 0, n, a[i]);
  }
}
void task() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  push(a);
  for (int i = 0; i < n; ++i) cin >> a[i];
  push(a);
  (void(1));
  build_ans(a);
  for (int i = 0; i < n; ++i) cout << a[i] << ' ';
}
