#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
inline int getint() {
  int w = 0, q = 0;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') q = 1, c = getchar();
  while (c >= '0' && c <= '9') w = w * 10 + c - '0', c = getchar();
  return q ? -w : w;
}
int n;
int a[1000];
int b[1000];
int ans[1000];
int cnt;
int main() {
  n = getint();
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    b[i] = getint();
  }
  for (int i = 1; i <= n; i++) {
    a[i] = getint();
  }
  int t = 1;
  for (int i = 1; i < n; i++) {
    for (int j = i; j <= n; j++) {
      if (a[j] == b[i]) {
        t = j;
      }
    }
    ans[i] = t;
    cnt += t - i;
    for (int j = t; j > i; j--) {
      a[j] = a[j - 1];
    }
  }
  cout << cnt << endl;
  for (int i = 1; i <= n; i++) {
    if (ans[i] == i) {
      continue;
    } else {
      for (int j = ans[i]; j > i; j--) {
        cout << j - 1 << " " << j << endl;
      }
    }
  }
  return 0;
}
