#include <bits/stdc++.h>
using namespace std;
int tree[1000100];
int n;
void init() {
  for (int i = 0; i < 1000100; i++) tree[i] = 0;
}
void update(int idx, int val) {
  while (idx <= 1000100) {
    tree[idx] += val;
    idx += (idx & -idx);
  }
}
int query(int idx) {
  int sum = 0;
  while (idx > 0) {
    sum += tree[idx];
    idx -= (idx & -idx);
  }
  return sum;
}
void findOrder(int x[], int xorder[]) {
  init();
  for (int i = 0; i < n; i++) update(x[i] + 1, 1);
  for (int i = 0; i < n; i++) {
    xorder[i] = query(x[i]);
    update(x[i] + 1, -1);
  }
}
void addOrder(int x[], int y[], int z[]) {
  for (int i = 0; i < n; i++) z[i] = 0;
  for (int i = n - 1; i >= 0; i--) {
    z[i] += x[i] + y[i];
    if (i != 0) z[i - 1] += z[i] / (n - i);
    z[i] %= (n - i);
  }
}
void makePermutation(int x[], int xorder[]) {
  init();
  for (int i = 0; i < n; i++) update(i + 1, 1);
  int low, high, mid, find, ans, found;
  for (int i = 0; i < n; i++) {
    low = 1;
    high = n;
    find = xorder[i] + 1;
    while (low <= high) {
      mid = (low + high) / 2;
      found = query(mid);
      if (found < find)
        low = mid + 1;
      else {
        if (found == find) ans = mid;
        high = mid - 1;
      }
    }
    x[i] = ans - 1;
    update(x[i] + 1, -1);
  }
}
int main() {
  ios::sync_with_stdio(false);
  int i;
  cin >> n;
  int a[n], b[n], aorder[n], border[n], corder[n], c[n];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) cin >> b[i];
  findOrder(a, aorder);
  findOrder(b, border);
  addOrder(aorder, border, corder);
  makePermutation(c, corder);
  for (i = 0; i < n; i++) cout << c[i] << " ";
  cout << endl;
  return 0;
}
