#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 200003;
const ll mo = 998244353;
ll n, ans[N << 2], tag[N << 2], a[N], m, b[N], c[N], d[N];
long long real_rank;
inline ll lson(ll p) { return p << 1; }
inline ll rson(ll p) { return p << 1 | 1; }
inline void push_up(ll rt) { ans[rt] = ans[lson(rt)] + ans[rson(rt)]; }
inline void build(ll rt, ll l, ll r) {
  if (l == r) {
    ans[rt] = a[l];
    return;
  }
  ll mid = (l + r) >> 1;
  build(lson(rt), l, mid);
  build(rson(rt), mid + 1, r);
  push_up(rt);
}
inline void f(ll rt, ll l, ll r, ll k) {
  tag[rt] = tag[rt] + k;
  ans[rt] = ans[rt] + k * (r - l + 1);
}
inline void push_down(ll rt, ll l, ll r) {
  if (tag[rt] == 0) return;
  ll mid = (l + r) >> 1;
  f(lson(rt), l, mid, tag[rt]);
  f(rson(rt), mid + 1, r, tag[rt]);
  tag[rt] = 0;
}
inline void update(ll ql, ll qr, ll l, ll r, ll rt, ll k) {
  if (ql <= l && r <= qr) {
    tag[rt] = tag[rt] + k;
    ans[rt] = ans[rt] + k * (r - l + 1);
    return;
  }
  push_down(rt, l, r);
  ll mid = (l + r) >> 1;
  if (ql <= mid) update(ql, qr, l, mid, lson(rt), k);
  if (mid + 1 <= qr) update(ql, qr, mid + 1, r, rson(rt), k);
  push_up(rt);
}
ll query(ll ql, ll qr, ll l, ll r, ll rt) {
  if (ql <= l && r <= qr) return ans[rt];
  ll ret = 0, mid = (l + r) >> 1;
  push_down(rt, l, r);
  if (ql <= mid) ret += query(ql, qr, l, mid, lson(rt));
  if (mid + 1 <= qr) ret += query(ql, qr, mid + 1, r, rson(rt));
  return ret;
}
ll find(ll l, ll r, ll rt, ll x) {
  if (l == r) return l;
  ll mid = (l + r) >> 1, count_of_one = query(l, mid, l, r, rt);
  if (mid - l + 1 - count_of_one > x) return find(l, mid, lson(rt), x);
  return find(mid + 1, r, rson(rt), x - (mid - l + 1 - count_of_one));
}
int main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    ++a[i];
    b[i] = a[i] - query(1, a[i], 1, n, 1) - 1;
    update(a[i], a[i], 1, n, 1, 1);
  }
  memset(ans, 0, sizeof(ans));
  memset(tag, 0, sizeof(tag));
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    ++a[i];
    c[i] = a[i] - query(1, a[i], 1, n, 1) - 1;
    update(a[i], a[i], 1, n, 1, 1);
  }
  memset(ans, 0, sizeof(ans));
  memset(tag, 0, sizeof(tag));
  for (int i = 1; i <= n; ++i) {
    d[n - i] += (d[n - i + 1] + b[n - i + 1] + c[n - i + 1]) / i;
    d[n - i + 1] = (d[n - i + 1] + b[n - i + 1] + c[n - i + 1]) % i;
  }
  for (int i = 1; i <= n; ++i) {
    a[i] = find(1, n, 1, d[i]);
    update(a[i], a[i], 1, n, 1, 1);
    printf("%lld ", a[i] - 1);
  }
  return 0;
}
