#include <bits/stdc++.h>
using namespace std;
long long n;
template <class T, long long size>
struct fenwick {
  T a[size];
  void add(long long pos, const T& val) {
    ++pos;
    while (pos < size) {
      a[pos] += val;
      pos += pos & -pos;
    }
  }
  void cisti() { memset(a, 0, sizeof(a)); }
  T nadji(T y) {
    long long x = 0;
    for (long long j = 131072 * 2; j >= 1; j >>= 1) {
      if (a[x + j] <= y) {
        y -= a[x + j];
        x += j;
      }
    }
    return x;
  }
  T sum(long long pos) {
    ++pos;
    T ret = T();
    while (pos > 0) {
      ret += a[pos];
      pos -= pos & -pos;
    }
    return ret;
  }
};
fenwick<long long, 131072 * 2 + 1> drvo;
vector<long long> ord(vector<long long> p) {
  drvo.cisti();
  vector<long long> sol(n);
  for (long long i = 0; i < n; ++i) drvo.add(i, 1);
  for (long long i = 0; i < n; ++i) {
    drvo.add(p[i], -1);
    sol[i] = drvo.sum(p[i]);
  }
  return sol;
}
vector<long long> perm(vector<long long> a) {
  drvo.cisti();
  for (long long i = 0; i < n; ++i) {
    drvo.add(i, 1);
  }
  vector<long long> sol(n);
  for (long long i = 0; i < n; ++i) {
    sol[i] = drvo.nadji(a[i]);
    drvo.add(sol[i], -1);
  }
  return sol;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cerr.tie(nullptr);
  cin >> n;
  vector<long long> p(n), q(n);
  for (auto& i : p) cin >> i;
  for (auto& i : q) cin >> i;
  vector<long long> a = ord(p);
  vector<long long> b = ord(q);
  vector<long long> c(n);
  for (long long i = 0; i < n; ++i) c[i] = a[i] + b[i];
  for (long long i = n - 1; i >= 0; --i) {
    if (i > 0) {
      c[i - 1] += c[i] / (n - i);
    }
    c[i] %= (n - i);
  }
  vector<long long> sol = perm(c);
  for (long long i = 0; i < n; ++i) cout << sol[i] << ' ';
  cout << '\n';
}
