#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200005;
int calculateRotation(int n, int a, int b) {
  if (a <= b) return b - a;
  return n - (a - b);
}
int main() {
  int n;
  scanf("%d", &n);
  int apos[MAX_N], bpos[MAX_N], x;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    apos[x] = i;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    bpos[x] = i;
  }
  int sumReqRot[MAX_N];
  for (int i = 0; i < n; i++) sumReqRot[i] = 0;
  for (int x = 1; x <= n; x++)
    sumReqRot[calculateRotation(n, apos[x], bpos[x])]++;
  int result = 0;
  for (int i = 0; i < n; i++) {
    if (result < sumReqRot[i]) result = sumReqRot[i];
  }
  printf("%d\n", result);
  return 0;
}
