#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
constexpr int INF = 1e9 + 5, MOD = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  map<int, int> a, b;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    a[x] = i;
  }
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    b[x] = i;
  }
  map<int, int> dif;
  for (int i = 1; i <= n; ++i) {
    int d = b[i] - a[i];
    if (d < 0) d += n;
    ++dif[d];
  }
  int mx = 0;
  for (auto const& p : dif) mx = max(mx, p.second);
  cout << mx << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  srand(time(0));
  int t;
  t = 1;
  while (t--) solve();
  return 0;
}
