#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
void i_love_Accepted() {
  ll n;
  cin >> n;
  unordered_map<ll, ll> p1, p2;
  ll k;
  for (long long int i = 0; i <= n - 1; i++) {
    cin >> k;
    p1[k] = i + 1;
  }
  for (long long int i = 0; i <= n - 1; i++) {
    cin >> k;
    if (i + 1 >= p1[k])
      p2[k] = i + 1 - p1[k];
    else
      p2[k] = i + 1 + n - p1[k];
  }
  ll ans = 0, f = 0;
  p1.clear();
  for (auto i = p2.begin(); i != p2.end(); i++) p1[i->second]++;
  for (auto i = p1.begin(); i != p2.end(); i++) ans = max(ans, i->second);
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  ll t = 1;
  while (t--) {
    i_love_Accepted();
    cout << "\n";
    ;
  }
}
