#include <bits/stdc++.h>
using namespace std;
int n;
int c[200005];
int p[200005], q[200005];
int res[200005];
int sum(int i) {
  int ans = 0;
  while (i > 0) {
    ans += c[i];
    i -= i & -i;
  }
  return ans;
}
void add(int i, int val) {
  while (i <= n) {
    c[i] += val;
    i += i & -i;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &p[i]);
  for (int i = 0; i < n; ++i) scanf("%d", &q[i]);
  memset(res, 0, sizeof(res));
  memset(c, 0, sizeof(c));
  for (int i = n - 1; i >= 0; --i) {
    res[n - 1 - i] += sum(p[i]);
    add(p[i] + 1, 1);
  }
  memset(c, 0, sizeof(c));
  for (int i = n - 1; i >= 0; --i)
    res[n - 1 - i] += sum(q[i]), add(q[i] + 1, 1);
  memset(c, 0, sizeof(c));
  for (int i = 0; i < n; ++i) res[i + 1] += res[i] / (i + 1), res[i] %= i + 1;
  for (int i = 1; i <= n; ++i) add(i, 1);
  for (int i = n - 1; i >= 0; --i) {
    int l = 1, r = n, ans = n;
    while (l <= r) {
      int mid = l + r >> 1;
      if (sum(mid) >= res[i] + 1) {
        ans = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    add(ans, -1);
    printf("%d ", ans - 1);
  }
}
