#include <bits/stdc++.h>
using namespace std;
inline void EnableFileIO(const string &fileName) {
  if (fileName.empty()) return;
  freopen((fileName + ".in").c_str(), "r", stdin);
  freopen((fileName + ".out").c_str(), "w", stdout);
  return;
}
const int INF = (1 << 30) - 1;
const long long LINF = (1LL << 61) - 1;
const double EPS = 1e-10;
const int N = 2e5 + 100;
int n;
int a[N], b[N];
int sum[N];
struct BIT {
  int node[N];
  void add(int x, int k) {
    for (++x; x < N; x += x & -x) node[x] += k;
  }
  int ask(int x) {
    int r = 0;
    for (++x; x; x -= x & -x) r += node[x];
    return r;
  }
} bita, bitb;
class Treap {
 private:
  struct Node {
    int val, fix, size;
    Node *ch[2];
    Node(int val) : val(val), fix(rand()), size(1) {
      memset(ch, NULL, sizeof ch);
    }
    inline void maintain() {
      size = 1;
      if (ch[0]) size += ch[0]->size;
      if (ch[1]) size += ch[1]->size;
    }
  };
  Node *root;
  inline void rotate(Node *&t, int d) {
    Node *k = t->ch[d ^ 1];
    t->ch[d ^ 1] = k->ch[d];
    k->ch[d] = t;
    t->maintain();
    k->maintain();
    t = k;
  }
  void insert(Node *&t, int val) {
    if (t == NULL) {
      t = new Node(val);
    } else {
      int d = t->val <= val;
      insert(t->ch[d], val);
      if (t->ch[d]->fix < t->fix) rotate(t, d ^ 1);
    }
    t->maintain();
  }
  void erase(Node *&t, int val) {
    if (t->val == val) {
      Node *k = t;
      if (t->ch[0] == NULL) {
        t = t->ch[1];
        delete k;
        k = NULL;
      } else if (t->ch[1] == NULL) {
        t = t->ch[0];
        delete k;
        k = NULL;
      } else {
        int d = t->ch[0]->fix < t->ch[1]->fix;
        rotate(t, d);
        erase(t->ch[d], val);
      }
    } else {
      erase(t->ch[t->val < val], val);
    }
    if (t != NULL) t->maintain();
  }
  int getkth(Node *t, int k) {
    if (t->ch[1] == NULL && k == 1) return t->val;
    if (t->ch[1] == NULL) return getkth(t->ch[0], k - 1);
    if (t->ch[1]->size >= k) return getkth(t->ch[1], k);
    if (t->ch[1]->size + 1 == k) return t->val;
    return getkth(t->ch[0], k - t->ch[1]->size - 1);
  }

 public:
  inline void insert(int val) { insert(root, val); }
  inline void erase(int val) { erase(root, val); }
  inline int getkth(int k) { return getkth(root, k); }
  inline int size() { return (root == NULL ? 0 : root->size); }
  inline bool empty() { return (root == NULL); }
} tp;
int main() {
  srand(time(0));
  ios::sync_with_stdio(false);
  cin.tie(0);
  EnableFileIO("");
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 0; i < n; i++) scanf("%d", b + i);
  for (int i = 0; i < n; i++) {
    bita.add(i, 1);
    bitb.add(i, 1);
    tp.insert(-i);
  }
  for (int i = 0; i < n; i++) {
    sum[n - i - 1] += bita.ask(a[i] - 1) + bitb.ask(b[i] - 1);
    bita.add(a[i], -1);
    bitb.add(b[i], -1);
  }
  for (int i = 0; i < n; i++) {
    if (sum[i] >= i + 1) {
      sum[i + 1] += sum[i] / (i + 1);
      sum[i] %= i + 1;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    int k = tp.getkth(sum[i] + 1);
    printf("%d ", -k);
    tp.erase(k);
  }
  return 0;
}
