#include <bits/stdc++.h>
using namespace std;
class opr {
 public:
  int q;
  int w;
  opr *pNext;
  opr *pLost;
};
opr *pHead = 0;
opr *pTail = 0;
opr *pN = 0;
void addvalue(int e, int r) {
  opr *p = new opr;
  if (pHead == 0) {
    p->q = e;
    p->w = r;
    p->pNext = 0;
    p->pLost = 0;
    pHead = p;
    pTail = p;
    pN = p;
  } else {
    p->q = e;
    p->w = r;
    p->pLost = pN;
    p->pNext = 0;
    pN->pNext = p;
    pN = p;
    pTail = p;
  }
}
void resilt() {
  pN = pHead;
  while (pN != 0) {
    cout << pN->q << " " << pN->w << endl;
    pN = pN->pNext;
  }
}
int main() {
  int n;
  cin >> n;
  int *old = new int[n];
  int *nw = new int[n];
  for (int i = 0; i < n; i++) cin >> old[i];
  for (int i = 0; i < n; i++) cin >> nw[i];
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (old[i] != nw[i]) {
      int k = i + 1;
      while (old[i] != nw[k]) k++;
      addvalue(k - 1 + 1, k + 1);
      int temp = nw[k];
      nw[k] = nw[k - 1];
      nw[k - 1] = temp;
      sum++;
      if ((k - 1) != i) i--;
    }
  }
  cout << sum << endl;
  resilt();
  return 0;
}
