#include <bits/stdc++.h>
using namespace std;
const int N = 200 * 1000 + 20;
int p[N], q[N], n, ans[N], cnt[N], seg[N << 2];
void build(int id = 1, int st = 0, int en = n) {
  if (en - st == 1) {
    seg[id] = 1;
    return;
  }
  int mid = st + en >> 1;
  build(id << 1, st, mid);
  build(id << 1 | 1, mid, en);
  seg[id] = seg[id << 1] + seg[id << 1 | 1];
}
void update(int idx, int id = 1, int st = 0, int en = n) {
  if (en - st == 1) {
    seg[id] = 0;
    return;
  }
  int mid = st + en >> 1;
  if (idx < mid)
    update(idx, id << 1, st, mid);
  else
    update(idx, id << 1 | 1, mid, en);
  seg[id] = seg[id << 1] + seg[id << 1 | 1];
}
int get(int l, int r, int id = 1, int st = 0, int en = n) {
  if (l <= st && en <= r) return seg[id];
  if (r <= st || en <= l) return 0;
  int mid = st + en >> 1;
  return get(l, r, id << 1, st, mid) + get(l, r, id << 1 | 1, mid, en);
}
int get2(int val, int id = 1, int st = 0, int en = n) {
  if (en - st == 1) return st;
  int mid = st + en >> 1;
  if (val < seg[id << 1])
    return get2(val, id << 1, st, mid);
  else
    return get2(val - seg[id << 1], id << 1 | 1, mid, en);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) cin >> q[i];
  build();
  for (int i = 0; i < n; i++) {
    cnt[n - i - 1] = get(0, p[i]);
    update(p[i]);
  }
  build();
  for (int i = 0; i < n; i++) {
    cnt[n - i - 1] += get(0, q[i]);
    update(q[i]);
  }
  for (int i = 0; i < n; i++) {
    cnt[i + 1] += cnt[i] / (i + 1);
    cnt[i] %= i + 1;
  }
  build();
  for (int i = n - 1; ~i; i--) {
    ans[n - i - 1] = get2(cnt[i]);
    update(ans[n - i - 1]);
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  return cout << "\n", 0;
}
