#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  map<int, int> idA, idB, left;
  int a[n << 1], b[n << 1];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    idA[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
    idB[b[i]] = i;
  }
  int ans = 0;
  for (auto val : idA) {
    int x;
    if (idB[val.first] >= idA[val.first])
      x = idB[val.first] - idA[val.first];
    else
      x = idB[val.first] + (n - idA[val.first]);
    left[x]++;
    ans = max(ans, left[x]);
  }
  printf("%d", ans);
  return 0;
}
