#include <bits/stdc++.h>
using namespace std;
int N;
int A[300], B[300];
pair<int, int> arr[300], arr2[300];
int BIT[300 + 1];
int camb[300];
int W[300];
int main() {
  int i, j, tmp;
  int res = 0;
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    arr[i] = pair<int, int>(A[i], i);
  }
  for (i = 0; i < N; i++) {
    scanf("%d", &B[i]);
    arr2[i] = pair<int, int>(B[i], i);
  }
  sort(arr, arr + N);
  sort(arr2, arr2 + N);
  for (i = 0; i < N; i++) {
    B[arr2[i].second] = arr[i].second + 1;
  }
  for (i = N - 1; i >= 0; i--) {
    for (j = B[i] - 1; j; j -= (j & -j)) camb[i] += BIT[j];
    res += camb[i];
    for (j = B[i]; j <= 300; j += (j & -j)) BIT[j]++;
  }
  cout << res << endl;
  for (i = N - 1; i >= 0; i--) {
    tmp = B[i];
    for (j = i + 1; camb[i]; j++) {
      printf("%d %d\n", j, j + 1);
      if (B[j] < tmp) camb[i]--;
      swap(B[j], B[j - 1]);
      swap(W[j], W[j - 1]);
    }
  }
  return 0;
}
