#include <bits/stdc++.h>
using namespace std;
void readint(int &x) {
  x = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') x = (x * 10) + c - '0', c = getchar();
}
void putint(int x) {
  if (x >= 10) putint(x / 10);
  putchar(x % 10 + '0');
}
int n;
int p[2][200200];
int dat[2][200200];
int ans[200200];
void update(int num, int pos, int val) {
  pos++;
  while (pos <= n) {
    dat[num][pos] += val;
    pos += (pos & -pos);
  }
}
int query(int num, int pos) {
  pos++;
  int ret = 0;
  while (pos > 0) {
    ret += dat[num][pos];
    pos -= (pos & -pos);
  }
  return ret;
}
int lmt = 0;
int bit_lower_bound(int num, int val) {
  int pos = 0, now_sum = 0;
  for (int i = lmt; i >= 0; i--) {
    if (pos + (1 << i) <= n && now_sum + dat[num][pos + (1 << i)] < val) {
      now_sum += dat[num][pos + (1 << i)];
      pos += (1 << i);
    }
  }
  return pos;
}
int main() {
  readint(n);
  while ((1 << lmt) <= n) lmt++;
  lmt--;
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < n; j++) readint(p[i][j]);
  memset(dat, 0, sizeof(dat));
  int add = 0;
  for (int i = n - 1; i >= 0; i--) {
    int sum = add;
    for (int num = 0; num < 2; num++) sum += query(num, p[num][i]);
    for (int num = 0; num < 2; num++) update(num, p[num][i], 1);
    ans[i] = sum % (n - i);
    add = sum / (n - i);
  }
  memset(dat, 0, sizeof(dat));
  for (int i = 0; i < n; i++) update(0, i, 1);
  for (int i = 0; i < n; i++) {
    ans[i] = bit_lower_bound(0, ans[i] + 1);
    update(0, ans[i], -1);
  }
  for (int i = 0; i < n; i++) putint(ans[i]), putchar(' ');
  puts("");
  return 0;
}
