#include <bits/stdc++.h>
using namespace std;
const int INF = 2123456789;
int a, b, c;
int n, m, k;
int x, y;
string s;
int start[500];
int target[500];
vector<pair<int, int> > ops;
int calendar[] = {0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
int search(int base, int val) {
  for (int i = base; i <= n; i++)
    if (start[i] == val) return i;
}
int rotate(int s, int e) {
  int rotations = 0;
  if (s == e) return 0;
  for (int i = s; i < e; i++) {
    rotations++;
    ops.push_back(make_pair(i, i + 1));
    int tmp = start[i];
    start[i] = start[i + 1];
    start[i + 1] = tmp;
  }
  for (int i = e - 1; i > s; i--) {
    rotations++;
    ops.push_back(make_pair(i - 1, i));
    int tmp = start[i - 1];
    start[i - 1] = start[i];
    start[i] = tmp;
  }
  return rotations;
}
int main() {
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) cin >> target[i];
  for (int i = 1; i <= n; i++) cin >> start[i];
  for (int i = 1; i <= n; i++) {
    int pos = search(i, target[i]);
    ans += rotate(i, pos);
  }
  cout << ans << endl;
  for (int i = 0; i < ops.size(); i++)
    cout << ops[i].first << " " << ops[i].second << endl;
  return 0;
}
