#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
struct Set {
  vector<int> bit;
  int n;
  Set(int M) {
    n = (int)M + 2;
    bit.resize(n);
  }
  void insert(int val) {
    for (++val; val < n; val += val & -val) {
      bit[val] += 1;
    }
  }
  void erase(int val) {
    for (++val; val < n; val += val & -val) {
      bit[val] -= 1;
    }
  }
  int index(int j) {
    int ans = -1;
    for (++j; j; j -= j & -j) {
      ans += bit[j];
    }
    return ans;
  }
  int lower_find(int val) {
    int idx = 0;
    for (int i = 31 - __builtin_clz(n); i >= 0; --i) {
      int nidx = idx | (1 << i);
      if (nidx < n && bit[nidx] < val) {
        val -= bit[nidx];
        idx = nidx;
      }
    }
    return idx;
  }
  int operator[](int id) {
    id++;
    return lower_find(id);
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t, n, m, k, q, x, a, b, c, d;
  cin >> n;
  vector<int> A(n), B(n);
  for (auto &it : A) {
    cin >> it;
  }
  for (auto &it : B) {
    cin >> it;
  }
  Set A_(n);
  Set B_(n);
  Set C_(n);
  for (int i = 0; i < n; i++) {
    A_.insert(i);
    B_.insert(i);
    C_.insert(i);
  }
  vector<int> v1(n + 1), v2(n + 1), ans(n + 1);
  for (int i = 1; i <= n; i++) {
    v1[i] = A_.index(A[i - 1]);
    A_.erase(A[i - 1]);
    v2[i] = B_.index(B[i - 1]);
    B_.erase(B[i - 1]);
  }
  reverse(v1.begin(), v1.end());
  reverse(v2.begin(), v2.end());
  for (int i = 1; i < n; i++) {
    ans[i] += (v1[i] + v2[i]) % (i + 1);
    v1[i + 1] += (v1[i] + v2[i]) / (i + 1);
  }
  for (int i = n - 1; i >= 0; i--) {
    int t = C_[ans[i]];
    cout << t << " ";
    C_.erase(t);
  }
  return 0;
}
