#include <bits/stdc++.h>
using namespace std;
int n, BIG;
int tree[300010];
int get(int pos) {
  int ret = 0, i;
  for (i = pos; i; i -= (i & -i)) ret += tree[i];
  return ret;
}
void update(int pos, int val) {
  int i;
  for (i = pos; i <= 300005; i += (i & -i)) tree[i] += val;
}
vector<int> sum(300010, 0);
void ini_find() {
  int i;
  for (i = 20; i >= 0; i--) {
    if ((1 << i) & n) break;
  }
  BIG = 1 << i;
}
int find(int cumFre) {
  int idx = 0;
  int bitMask = BIG;
  while ((bitMask != 0) && idx <= n) {
    int tIdx = idx + bitMask;
    if (tIdx <= n && cumFre >= tree[tIdx]) {
      idx = tIdx;
      cumFre -= tree[tIdx];
    }
    bitMask >>= 1;
  }
  return idx;
}
vector<int> ans;
int main() {
  int i, j, k, val;
  scanf("%d", &n);
  ini_find();
  for (k = 0; k < 2; k++) {
    memset(tree, 0, sizeof(tree));
    for (i = 1; i <= n; i++) {
      update(i, 1);
    }
    for (i = 0, j = n - 1; i < n; i++, j--) {
      scanf("%d", &val);
      val++;
      int s = get(val - 1);
      sum[i] += s;
      update(val, -1);
    }
  }
  int c = 0;
  for (i = n - 1, j = 0; i >= 0; i--, j++) {
    sum[i] += c;
    int mod = (j + 1);
    c = sum[i] / mod;
    sum[i] %= mod;
  }
  memset(tree, 0, sizeof(tree));
  for (i = 1; i <= n; i++) {
    update(i, 1);
  }
  for (i = 0; i < n; i++) {
    int f = find(sum[i]) + 1;
    update(f, -1);
    ans.push_back(f - 1);
  }
  for (i = 0; i < ans.size(); i++) {
    if (i) printf(" ");
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
