#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000000")
using namespace std;
int n, a[200101], b[200101];
vector<int> fen[3];
bool in[200101];
void ft_create(int n, int x) { fen[x].assign(n + 1, 0); }
int ft_rsq(int b, int x) {
  int sum = 0;
  for (; b; b -= (b & (-b))) sum += fen[x][b];
  return sum;
}
int ft_rsq(int a, int b, int x) {
  return ft_rsq(b, x) - (a == 1 ? 0 : ft_rsq(a - 1, x));
}
void ft_adjust(int k, int v, int x) {
  for (; k < (int)fen[x].size(); k += (k & (-k))) fen[x][k] += v;
}
vector<int> ans;
long long lt1[200101], lt2[200101];
int main() {
  scanf("%d", &n);
  int tn = 1;
  ft_create(n + 1, 0);
  ft_create(n + 1, 1);
  ft_create(n + 1, 2);
  for (int i = 0; i < n; i++)
    scanf("%d", &a[i]), ft_adjust(i + 1, 1, 2), in[i] = 1;
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);
  for (int i = 0; i < n; i++) {
    ft_adjust(a[i] + 1, 1, 0);
    ft_adjust(b[i] + 1, 1, 1);
  }
  for (int i = 0; i < n; i++) {
    lt1[i] = ft_rsq(a[i], 0);
    lt2[i] = ft_rsq(b[i], 1);
    ft_adjust(a[i] + 1, -1, 0);
    ft_adjust(b[i] + 1, -1, 1);
  }
  int cr = 0;
  for (int i = n - 1; i >= 0; i--) {
    long long l1 = lt1[i];
    long long l2 = lt2[i];
    l1 += l2 + cr;
    cr = l1 / tn;
    a[i] = l1 % tn;
    tn++;
  }
  for (int i = 0; i < n; i++) {
    int tot = a[i] + 1;
    int l = 0, r = n, xx;
    while (l < r) {
      int mid = (l + r) / 2;
      int s = ft_rsq(mid + 1, 2);
      if (s == tot && in[mid]) {
        xx = mid;
        break;
      }
      if (s >= tot)
        r = mid;
      else
        l = mid + 1;
    }
    ans.push_back(xx);
    ft_adjust(xx + 1, -1, 2);
    in[xx] = 0;
  }
  for (int i = 0; i < ans.size(); i++) printf("%d ", ans[i]);
  return 0;
}
