#include <bits/stdc++.h>
using namespace std;
int N[200004], n, cnt[200004], s[200004];
int Lowerbit(int x) { return x & (-x); }
void Update(int pos) {
  pos++;
  while (pos <= n) {
    cnt[pos]++;
    pos += Lowerbit(pos);
  }
}
int Sum(int pos) {
  pos++;
  int tmp = 0;
  while (pos > 0) {
    tmp += cnt[pos];
    pos -= Lowerbit(pos);
  }
  return tmp;
}
void Count() {
  memset(cnt, 0, sizeof(int) * (n + 1));
  for (int i = 0; i != n; i++) {
    int k = Sum(N[i]);
    s[n - 1 - i] += N[i] - k;
    Update(N[i]);
  }
}
void Arrange() {
  for (int i = 0; i != n; i++) {
    if (s[i] >= i + 1) {
      int k = s[i] / (i + 1);
      s[i + 1] += k;
      s[i] -= k * (i + 1);
    }
  }
}
int Bsearch(int num) {
  int l = 0, r = n - 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    int k = mid - Sum(mid - 1);
    if (num >= k)
      l = mid + 1;
    else
      r = mid - 1;
  }
  return (l + r) >> 1;
}
void Generate() {
  memset(cnt, 0, sizeof(cnt));
  for (int i = n - 1; i >= 0; i--) {
    int tmp = s[i];
    int num = Bsearch(tmp);
    Update(num);
    printf("%d%c", num, i == 0 ? '\n' : ' ');
  }
}
int main() {
  scanf("%d", &n);
  memset(s, 0, sizeof(s));
  for (int i = 0; i != n; i++) scanf("%d", &N[i]);
  Count();
  for (int i = 0; i != n; i++) scanf("%d", &N[i]);
  Count();
  Arrange();
  Generate();
  return 0;
}
