#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using bigint = int64_t;
const int MOD = 1000000007;
void io_set() {}
void solve() {
  ll n, out = 0;
  cin >> n;
  map<ll, ll> mpp, ppm, ans;
  ll a[n], b[n];
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    mpp[a[i]] = i;
  }
  for (ll i = 0; i < n; i++) {
    cin >> b[i];
    ppm[b[i]] = i;
    ll diff = mpp[b[i]] - ppm[b[i]];
    if (diff < 0) {
      diff += n;
    }
    ans[diff]++;
  }
  for (auto it : ans) {
    out = max(out, it.second);
  }
  cout << out << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  ;
  io_set();
  ll tt = 1;
  while (tt--) {
    solve();
  }
  return 0;
}
