#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng((long long)new char);
const double eps = 1e-10;
const int maxn = 1000010;
const long double INF = 1e15;
const int mod = 1e9 + 7;
int n;
int a[maxn], b[maxn];
struct Node {
  Node* ch[2];
  int r;
  int v;
  int s;
  Node(int v = 0) : v(v) {
    ch[0] = ch[1] = NULL;
    r = rand();
    s = 1;
  }
  int cmp(int x) const {
    if (x == v) return -1;
    return x < v ? 0 : 1;
  }
  void maintain() {
    s = 1;
    if (ch[0] != NULL) s += ch[0]->s;
    if (ch[1] != NULL) s += ch[1]->s;
  }
};
void rotate(Node*& o, int d) {
  Node* k = o->ch[d ^ 1];
  o->ch[d ^ 1] = k->ch[d];
  k->ch[d] = o;
  o->maintain();
  k->maintain();
  o = k;
}
void insert(Node*& o, int x) {
  if (o == NULL)
    o = new Node(x);
  else {
    int d = (x < o->v ? 0 : 1);
    insert(o->ch[d], x);
    if (o->ch[d]->r > o->r) rotate(o, d ^ 1);
  }
  o->maintain();
}
Node* find(Node* o, int x) {
  if (o == NULL) return NULL;
  if (x == o->v) return o;
  return x < o->v ? find(o->ch[0], x) : find(o->ch[1], x);
}
void removetree(Node*& x) {
  if (x->ch[0] != NULL) removetree(x->ch[0]);
  if (x->ch[1] != NULL) removetree(x->ch[1]);
  delete x;
  x = NULL;
}
void mergeto(Node*& src, Node*& dest) {
  if (src->ch[0] != NULL) mergeto(src->ch[0], dest);
  if (src->ch[1] != NULL) mergeto(src->ch[1], dest);
  insert(dest, src->v);
  delete src;
  src = NULL;
}
void remove(Node*& o, int x) {
  int d = o->cmp(x);
  int ret = 0;
  if (d == -1) {
    Node* u = o;
    if (o->ch[0] != NULL && o->ch[1] != NULL) {
      int d2 = (o->ch[0]->r > o->ch[1]->r ? 1 : 0);
      rotate(o, d2);
      remove(o->ch[d2], x);
    } else {
      if (o->ch[0] == NULL)
        o = o->ch[1];
      else
        o = o->ch[0];
      delete u;
    }
  } else
    remove(o->ch[d], x);
  if (o != NULL) o->maintain();
}
int kth(Node* o, int k) {
  if (o == NULL || k <= 0 || k > o->s) return 0;
  int s = (o->ch[0] == NULL ? 0 : o->ch[0]->s);
  if (k == s + 1)
    return o->v;
  else if (k <= s)
    return kth(o->ch[0], k);
  else
    return kth(o->ch[1], k - s - 1);
}
int kthm(Node* o, int k) {
  if (o == NULL || k <= 0 || k > o->s) return 0;
  int s = (o->ch[1] == NULL ? 0 : o->ch[1]->s);
  if (k == s + 1)
    return o->v;
  else if (k <= s)
    return kth(o->ch[1], k);
  else
    return kth(o->ch[0], k - s - 1);
}
int Rank(Node* o, int x) {
  if (o == NULL) return 1;
  if (x <= o->v) return Rank(o->ch[0], x);
  return Rank(o->ch[1], x) + (o->ch[0] == NULL ? 0 : o->ch[0]->s) + 1;
}
Node *roota, *rootb, *ra;
int ans[maxn];
int aa[maxn], bb[maxn];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int t = (0); t < (n); ++t) cin >> a[t];
  for (int t = (0); t < (n); ++t) cin >> b[t];
  for (int t = (0); t < (n); ++t) insert(roota, t);
  memset(aa, 0, sizeof(aa)), memset(bb, 0, sizeof(bb));
  for (int t = (1); t < (n); ++t) {
    aa[t] = Rank(roota, a[t - 1]) - 1, remove(roota, a[t - 1]);
  }
  for (int t = (0); t < (n); ++t) insert(rootb, t);
  for (int t = (1); t < (n); ++t)
    bb[t] = Rank(rootb, b[t - 1]) - 1, remove(rootb, b[t - 1]);
  reverse(aa + 1, aa + n);
  reverse(bb + 1, bb + n);
  for (int t = (1); t < (n); ++t) aa[t] += bb[t];
  for (int t = (1); t < (n); ++t) {
    if (aa[t] > t) {
      while (aa[t] > t) aa[t] -= (t + 1), ++aa[t + 1];
    }
  }
  for (int t = (0); t < (n); ++t) insert(ra, t);
  for (int i = n - 1; i; --i) {
    ans[n - 1 - i] = kth(ra, aa[i] + 1);
    remove(ra, ans[n - 1 - i]);
  }
  ans[n - 1] = kth(ra, 1);
  for (int t = (0); t < (n); ++t) cout << ans[t] << " ";
}
