#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> rev_A(n), rev_B(n);
  for (int tmp, i = 0; i < n; ++i) {
    scanf("%d", &tmp);
    rev_A[tmp - 1] = i;
  }
  for (int tmp, i = 0; i < n; ++i) {
    scanf("%d", &tmp);
    rev_B[tmp - 1] = i;
  }
  vector<int> shift(n);
  for (int i = 0; i < n; ++i) ++shift[(n + rev_A[i] - rev_B[i]) % n];
  printf("%d\n", *max_element(begin(shift), end(shift)));
}
