#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n, ia[maxn], ib[maxn], ic[maxn];
pair<int, int> a[maxn], b[maxn];
int c[maxn];
vector<int> C;
struct TAS {
  int tr[maxn];
  void add(int x, int v) {
    for (; x < maxn; x += (x & -x)) tr[x] += v;
  }
  int sum(int x) {
    int ret = 0;
    for (; x > 0; x -= (x & -x)) ret += tr[x];
    return ret;
  }
} T, T2, T3;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].first;
    ++a[i].first;
    a[i].second = i;
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; ++i) {
    ia[a[i].second] = i - T.sum(a[i].second) - 1;
    T.add(a[i].second, 1);
  }
  for (int i = 1; i <= n; ++i) {
    cin >> b[i].first;
    ++b[i].first;
    b[i].second = i;
  }
  sort(b + 1, b + n + 1);
  for (int i = 1; i <= n; ++i) {
    ib[b[i].second] = i - T2.sum(b[i].second) - 1;
    T2.add(b[i].second, 1);
  }
  reverse(ib + 1, ib + n + 1);
  reverse(ia + 1, ia + n + 1);
  for (int i = 1; i <= n; ++i) {
    ic[i] += ia[i] + ib[i];
    ic[i + 1] += ic[i] / i;
    ic[i] = ic[i] % i;
    T3.add(i, 1);
  }
  for (int i = 1, x, l, r, mid; i <= n; ++i) {
    x = ic[n - i + 1];
    l = ic[n - i + 1] + 1;
    r = n + 1;
    while (l < r) {
      mid = l + r >> 1;
      if (T3.sum(mid) <= x)
        l = mid + 1;
      else
        r = mid;
    }
    mid = r;
    cout << mid - 1 << " ";
    T3.add(mid, -1);
  }
  return 0;
}
