#include <bits/stdc++.h>
typedef struct b_t {
  int x;
  int y;
} b_t;
int vis[300];
b_t a[300];
b_t b[300];
b_t c[300];
int n;
int swap_sort(int p) {
  int i, j;
  b_t k;
  int count = 0;
  for (i = 0; i < n; i++) c[i] = b[i];
  for (i = n; i >= 1; i--) {
    for (j = 1; j < i; j++) {
      if (c[j - 1].y > c[j].y) {
        if (p) printf("%d %d\n", j, j + 1);
        k = c[j - 1];
        c[j - 1] = c[j];
        c[j] = k;
        count++;
      }
    }
  }
  return count;
}
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i].x);
    a[i].y = i + 1;
  }
  for (i = 0; i < n; i++) {
    scanf("%d", &b[i].x);
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (b[i].x == a[j].x && vis[j] == 0) {
        vis[j] = 1;
        b[i].y = a[j].y;
        break;
      }
    }
  }
  for (i = 0; i < n; i++) {
  }
  for (i = 0; i < n; i++) {
  }
  printf("%d \n", swap_sort(0));
  swap_sort(1);
}
