#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)2e5 + 10;
const int inf = (int)1e9;
const int mod = (int)1e9 + 7;
const double eps = 1e-9;
int t[2][4 * maxn], tx[4 * maxn];
int p[maxn];
void upd(int num, int v, int tl, int tr, int pos) {
  if (tl == tr) {
    t[num][v] = 1;
    return;
  }
  int mid = (tl + tr) / 2;
  if (pos <= mid)
    upd(num, v + v, tl, mid, pos);
  else
    upd(num, v + v + 1, mid + 1, tr, pos);
  t[num][v] = t[num][v + v] + t[num][v + v + 1];
  return;
}
int get(int num, int v, int tl, int tr, int pos) {
  if (tr <= pos) return t[num][v];
  int mid = (tl + tr) / 2, res = 0;
  if (pos >= mid + 1) res = get(num, v + v + 1, mid + 1, tr, pos);
  return res + get(num, v + v, tl, mid, pos);
}
void upd_x(int v, int tl, int tr, int pos, int val) {
  if (tl == tr) {
    tx[v] = val;
    return;
  }
  int mid = (tl + tr) / 2;
  if (pos <= mid)
    upd_x(v + v, tl, mid, pos, val);
  else
    upd_x(v + v + 1, mid + 1, tr, pos, val);
  tx[v] = tx[v + v] + tx[v + v + 1];
  return;
}
int get_x(int v, int tl, int tr, int pos) {
  if (tl == tr) return tl;
  int mid = (tl + tr) / 2;
  if (tx[v + v] >= pos)
    return get_x(v + v, tl, mid, pos);
  else
    return get_x(v + v + 1, mid + 1, tr, pos - tx[v + v]);
}
void print(int v, int n) {
  if (v > n) return;
  int x = get_x(1, 0, n - 1, p[v] + 1);
  printf("%d ", x);
  upd_x(1, 0, n - 1, x, 0);
  print(v + 1, n);
  return;
}
int n, a[maxn], b[maxn], carry;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  for (int i = 1; i <= n; ++i) scanf("%d", b + i);
  p[n] = 0;
  upd(0, 1, 0, n - 1, a[n]);
  upd(1, 1, 0, n - 1, b[n]);
  for (int i = n - 1; i >= 1; --i) {
    p[i] = (get(0, 1, 0, n - 1, a[i]) + get(1, 1, 0, n - 1, b[i]) + carry);
    upd(0, 1, 0, n - 1, a[i]);
    upd(1, 1, 0, n - 1, b[i]);
    carry = p[i] / (n - i + 1);
    p[i] %= (n - i + 1);
  }
  for (int i = 1; i <= n; ++i) cerr << p[i] << ' ';
  cerr << "\n\n";
  for (int i = 0; i < n; ++i) upd_x(1, 0, n - 1, i, 1);
  print(1, n);
  return 0;
}
