#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[200005], b[200005];
long long trea[2000005], treb[2000005];
long long ta[200005], tb[200005];
long long c[200005];
void read() {
  long long i;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
}
void up1(long long idx, long long l, long long r, long long x) {
  if (l > x || r < x || l > r) return;
  if (l == r) {
    trea[idx] = 1;
    return;
  }
  long long mid = (l + r) / 2;
  up1(idx * 2, l, mid, x);
  up1(idx * 2 + 1, mid + 1, r, x);
  trea[idx] = trea[idx * 2] + trea[idx * 2 + 1];
}
void up2(long long idx, long long l, long long r, long long x) {
  if (l > x || r < x || l > r) return;
  if (l == r) {
    treb[idx] = 1;
    return;
  }
  long long mid = (l + r) / 2;
  up2(idx * 2, l, mid, x);
  up2(idx * 2 + 1, mid + 1, r, x);
  treb[idx] = treb[idx * 2] + treb[idx * 2 + 1];
}
long long sum1(long long idx, long long l, long long r, long long u,
               long long v) {
  if (l > v || r < u || l > r) return 0;
  if (l >= u && r <= v) {
    return trea[idx];
  }
  long long mid = (l + r) / 2;
  return (sum1(idx * 2, l, mid, u, v) + sum1(idx * 2 + 1, mid + 1, r, u, v));
}
long long sum2(long long idx, long long l, long long r, long long u,
               long long v) {
  if (l > v || r < u || l > r) return 0;
  if (l >= u && r <= v) {
    return treb[idx];
  }
  long long mid = (l + r) / 2;
  return (sum2(idx * 2, l, mid, u, v) + sum2(idx * 2 + 1, mid + 1, r, u, v));
}
long long tree[2000005];
long long nc[200005];
void update(long long idx, long long l, long long r, long long x) {
  if (l > x || r < x || l > r) return;
  if (l == r) {
    tree[idx] = 1;
    return;
  }
  long long mid = (l + r) / 2;
  update(idx * 2, l, mid, x);
  update(idx * 2 + 1, mid + 1, r, x);
  tree[idx] = tree[idx * 2] + tree[idx * 2 + 1];
}
long long solve(long long idx, long long l, long long r, long long x) {
  if (l == r) return l;
  long long mid = (l + r) / 2;
  if (mid - l + 1 - tree[idx * 2] > x) {
    return solve(idx * 2, l, mid, x);
  }
  return solve(idx * 2 + 1, mid + 1, r, x - (mid - l + 1 - tree[idx * 2]));
}
int main() {
  read();
  long long i, j;
  long long x;
  for (i = 0; i < n; i++) {
    x = sum1(1, 1, n, 1, a[i] + 1);
    ta[i] = a[i] - x;
    up1(1, 1, n, a[i] + 1);
  }
  for (i = 0; i < n; i++) {
    x = sum2(1, 1, n, 1, b[i] + 1);
    tb[i] = b[i] - x;
    up2(1, 1, n, b[i] + 1);
  }
  for (i = n - 1; i >= 0; i--) {
    if (i != 0) {
      c[i - 1] = (ta[i] + tb[i] + c[i]) / (n - i);
    }
    c[i] = (ta[i] + tb[i] + c[i]) % (n - i);
  }
  for (i = 0; i < n; i++) {
    x = solve(1, 1, n, c[i]);
    nc[i] = x;
    cout << x - 1 << " ";
    update(1, 1, n, x);
  }
  cout << endl;
  return 0;
}
