#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int snum;
  scanf("%d", &snum);
  vector<int> correct(snum + 1);
  vector<int> wrong(snum + 1);
  vector<int> relabeled(snum + 1);
  map<int, int> nextsearch;
  list<int> moves;
  for (int k = 1; k <= snum; k++) scanf("%d", &correct[k]);
  for (int k = 1; k <= snum; k++) scanf("%d", &wrong[k]);
  for (int k = 1; k <= snum; k++) nextsearch.insert(make_pair(correct[k], 0));
  for (int k = 1; k <= snum; k++) {
    for (++nextsearch[correct[k]]; wrong[nextsearch[correct[k]]] != correct[k];
         nextsearch[correct[k]]++)
      ;
    relabeled[nextsearch[correct[k]]] = k;
  }
  for (int k = snum; k > 0; k--) {
    int ind;
    for (ind = 1; relabeled[ind] != k; ind++)
      ;
    while (ind < k) {
      swap(relabeled[ind], relabeled[ind + 1]);
      moves.push_back(ind);
      ind++;
    }
  }
  printf("%u\n", moves.size());
  list<int>::iterator lit = moves.begin();
  for (; lit != moves.end(); ++lit) printf("%d %d\n", *lit, (*lit) + 1);
  return 0;
}
