#include <bits/stdc++.h>
using namespace std;
vector<long long int> bit(2e5 + 5);
void upd(long long int x, long long int val) {
  for (; x < 2e5 + 5; x += x & (-x)) bit[x] += val;
}
long long int query(long long int x) {
  long long int s = 0;
  for (; x > 0; x -= x & (-x)) s += bit[x];
  return s;
}
int main() {
  long long int n, i, l, r, m, cc;
  cin >> n;
  vector<long long int> a(n), b(n), c(n);
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  for (i = 1; i <= n; i++) upd(i, 1);
  for (i = 0; i < n; i++) c[i] = query(a[i] + 1) - 1, upd(a[i] + 1, -1);
  a = c;
  for (i = 1; i <= n; i++) upd(i, 1);
  for (i = 0; i < n; i++) c[i] = query(b[i] + 1) - 1, upd(b[i] + 1, -1);
  for (i = 0; i < n; i++) a[i] += c[i];
  for (i = n - 1; i >= 0; i--) {
    if (i) a[i - 1] += a[i] / (n - i);
    a[i] %= (n - i);
  }
  for (i = 1; i <= n; i++) upd(i, 1);
  for (i = 0; i < n; i++) {
    l = cc = 0, r = 2e5 + 5;
    while (cc++ < 30) {
      m = (l + r) / 2;
      long long int x = query(m);
      if (x == a[i] + 1 && query(m - 1) < x) break;
      if (x < a[i] + 1)
        l = m;
      else
        r = m;
    }
    upd(m, -1);
    b[i] = m - 1;
  }
  for (long long int it = 0; it < b.size(); it++) cout << b[it] << " ";
  cout << endl;
}
