#include <bits/stdc++.h>
using namespace std;
inline long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
const long long maxn = 2e5 + 10;
const long long mod = 1e9 + 7;
long long a[maxn], b[maxn], indx, n;
long long cnt[4 * maxn];
inline void build(long long p = 0, long long l = 0, long long r = n - 1) {
  if (l == r) {
    cnt[p] = 1;
    return;
  }
  long long mid = (l + r) >> 1;
  build(2 * p + 1, l, mid);
  build(2 * p + 2, mid + 1, r);
  cnt[p] = r - l + 1;
}
inline long long get(long long id, long long p = 0, long long l = 0,
                     long long r = n - 1) {
  if (l == r) {
    cnt[p] = 0;
    return l;
  }
  long long mid = (l + r) >> 1;
  if (cnt[2 * p + 1] >= id) {
    long long ret = get(id, 2 * p + 1, l, mid);
    ;
    cnt[p] = cnt[2 * p + 1] + cnt[2 * p + 2];
    return ret;
  }
  long long ret = get(id - cnt[2 * p + 1], 2 * p + 2, mid + 1, r);
  cnt[p] = cnt[2 * p + 1] + cnt[2 * p + 2];
  return ret;
}
inline void update(long long id, long long p = 0, long long l = 0,
                   long long r = n - 1) {
  if (l > id || r < id) return;
  if (l == r) {
    cnt[p] = 0;
    return;
  }
  long long mid = (l + r) >> 1;
  update(id, 2 * p + 1, l, mid), update(id, 2 * p + 2, mid + 1, r);
  cnt[p] = cnt[2 * p + 1] + cnt[2 * p + 2];
}
inline long long get_id(long long ql, long long qr, long long p = 0,
                        long long l = 0, long long r = n - 1) {
  if (l > qr || r < ql) return 0;
  if (l >= ql && r <= qr) return cnt[p];
  long long mid = (l + r) >> 1;
  return get_id(ql, qr, 2 * p + 1, l, mid) +
         get_id(ql, qr, 2 * p + 2, mid + 1, r);
}
long long X[maxn];
inline void SS(long long *a) {
  for (long long i = 0; i < n; i++) {
    long long where = get_id(0, a[i]) - 1;
    update(a[i]);
    X[i] += where;
  }
}
int32_t main() {
  n = in();
  for (long long i = 0; i < n; i++) a[i] = in();
  for (long long i = 0; i < n; i++) b[i] = in();
  build();
  SS(a);
  build();
  SS(b);
  for (long long i = n - 1; i >= 0; i--) {
    if (i) X[i - 1] += X[i] / (n - i);
    X[i] %= (n - i);
  }
  build();
  for (long long i = 0; i < n; i++) {
    cout << get(X[i] + 1) << " ";
  }
}
