#include <bits/stdc++.h>
using namespace std;
struct dbg_cls {
  template <class T>
  dbg_cls &operator<<(const T &oth) {
    return *this;
  }
} dbg;
using ll = long long;
int main(int argc, char **argv) {
  ios::sync_with_stdio(false), cin.tie(0);
  auto solve = [&]() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) cin >> a[i], --a[i];
    for (int i = 0; i < n; i++) cin >> b[i], --b[i];
    vector<int> inva(n), invb(n);
    for (int i = 0; i < n; i++) inva[a[i]] = i, invb[b[i]] = i;
    vector<int> cnt(n);
    for (int r = 0; r < n; r++) cnt[(invb[r] - inva[r] + n) % n]++;
    cout << *max_element(cnt.begin(), cnt.end()) << '\n';
  };
  int t;
  t = 1;
  while (t--) solve();
  return 0;
}
