#include <bits/stdc++.h>
using namespace std;
inline int LB(int x) { return x & (-x); }
struct BIT {
  long long _[211111];
  int n;
  void init(int m) {
    n = m + 5;
    for (int i = 0; i <= n; i++) _[i] = 0;
  }
  long long query(int w) {
    long long ret = 0;
    for (w += 3; w > 0; w -= LB(w)) ret += _[w];
    return ret;
  }
  void update(int w, long long d) {
    for (w += 3; w < n; w += LB(w)) _[w] += d;
  }
  int find_Kth(int k) {
    int idx = 0;
    for (int i = 20; i >= 0; i--) {
      idx |= 1 << i;
      if (idx <= n && _[idx] < k)
        k -= _[idx];
      else
        idx ^= 1 << i;
    }
    return idx - 2;
  }
} bita, bitb, bitc;
int A[211111], B[211111], C[211111], first[211111], second[211111], CC[211111];
int n;
int main() {
  int i, j, k, u, v, w;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++) {
      scanf("%d", &A[i]);
    }
    for (i = 0; i < n; i++) {
      scanf("%d", &B[i]);
    }
    if (n == 1) {
      printf("0\n");
      continue;
    }
    bita.init(n + 10);
    bitb.init(n + 10);
    bitc.init(n + 10);
    for (i = n - 1; i >= 0; i--) {
      u = bita.query(A[i]);
      v = u;
      first[i] = v;
      bita.update(A[i], 1);
    }
    for (i = n - 1; i >= 0; i--) {
      u = bitb.query(B[i]);
      v = u;
      second[i] = v;
      bitb.update(B[i], 1);
    }
    for (i = n - 1, j = 1, w = 0; i >= 0; i--, j++) {
      w += first[i] + second[i];
      CC[i] = w % j;
      w = w / j;
    }
    for (i = 0; i < n; i++) bitc.update(i, 1);
    for (i = 0, j = n; i < n; i++, j--) {
      w = CC[i];
      k = bitc.find_Kth(w + 1);
      C[i] = k;
      bitc.update(k, -1);
    }
    for (i = 0; i < n; i++) {
      if (i) printf(" ");
      printf("%d", C[i]);
    }
    printf("\n");
  }
  return 0;
}
