#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
int n, a[N], bit[N];
void upd(int i, int x) {
  for (int j = i; j < N; j += j & -j) bit[j] += x;
}
int qry(int i) {
  int ans = 0;
  for (int j = i; j > 0; j -= j & -j) ans += bit[j];
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  int x;
  int t = 2;
  while (t--) {
    memset(bit, 0, sizeof(bit));
    for (int i = 1; i <= n; ++i) {
      cin >> x;
      a[i] += x - qry(x + 1);
      upd(x + 1, 1);
    }
  }
  for (int i = n - 1; i > 1; --i) {
    if (a[i] >= n - i + 1) {
      a[i] -= n - i + 1;
      a[i - 1]++;
    }
  }
  a[1] %= n;
  for (int i = 1; i <= n; ++i) {
    int l, r, x;
    l = 1, r = n;
    x = 0;
    while (l <= r) {
      int m = (l + r) / 2;
      if (qry(m) < a[i] + 1) l = m + 1;
      if (qry(m) >= a[i] + 1) {
        if (qry(m) == a[i] + 1) x = m;
        r = m - 1;
      }
    }
    cout << x - 1 << ' ';
    upd(x, -1);
  }
}
