#include <bits/stdc++.h>
using namespace std;
const int N = 1 << 19;
int seg[N], smp[N];
int cnt[N];
void cst(int l, int r, int i) {
  if (l == r) {
    seg[i] = 1;
    smp[l] = i;
    return;
  }
  int mid = l + r >> 1;
  cst(l, mid, i + i + 1);
  cst(mid + 1, r, i + i + 2);
  seg[i] = seg[i + i + 1] + seg[i + i + 2];
}
int Rank(int l, int r, int x, int i) {
  if (l > x) return 0;
  if (r <= x) return seg[i];
  int mid = l + r >> 1;
  return Rank(l, mid, x, i + i + 1) + Rank(mid + 1, r, x, i + i + 2);
}
int kth(int l, int r, int k, int i) {
  if (l == r) return l;
  int mid = l + r >> 1;
  if (seg[i + i + 1] >= k) return kth(l, mid, k, i + i + 1);
  return kth(mid + 1, r, k - seg[i + i + 1], i + i + 2);
}
void rem(int x) {
  int i = smp[x];
  seg[i] = 0;
  while (i > 0) {
    i = (i - 1) / 2;
    seg[i] = seg[i + i + 1] + seg[i + i + 2];
  }
}
void ord(vector<int>& p) {
  memset(seg, 0, sizeof seg);
  int n = p.size();
  cst(0, n - 1, 0);
  for (int i = 0; i < n; ++i) {
    int r = Rank(0, n - 1, p[i], 0) - 1;
    cnt[n - i - 1] += r;
    rem(p[i]);
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int& x : a) cin >> x;
  for (int& x : b) cin >> x;
  ord(a);
  ord(b);
  for (int i = 0; i < n; ++i) {
    int t = cnt[i] / (i + 1);
    cnt[i + 1] += t;
    cnt[i] -= t * (i + 1);
  }
  memset(seg, 0, sizeof seg);
  cst(0, n - 1, 0);
  vector<int> our(n);
  for (int i = n - 1; i >= 0; --i) {
    our[n - 1 - i] = kth(0, n - 1, cnt[i] + 1, 0);
    rem(our[n - 1 - i]);
  }
  for (int& x : our) cout << x << ' ';
}
