#include <bits/stdc++.h>
using namespace std;
class CRotationMatching {
 public:
  void solve(istream& in, ostream& out) {
    int n;
    in >> n;
    vector<int> pos(n);
    for (int i = 0; i < n; ++i) {
      int a;
      in >> a;
      pos[a - 1] = i;
    }
    vector<int> cnt(n);
    for (int i = 0; i < n; ++i) {
      int b;
      in >> b;
      ++cnt[(pos[b - 1] - i + n) % n];
    }
    out << *max_element(cnt.begin(), cnt.end()) << '\n';
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  CRotationMatching solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
