#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t, n;
  t = 1;
  while (t--) {
    cin >> n;
    long long a[n], b[n];
    map<long long, long long> mp1, mp2, mp3;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      mp1[a[i]] = i;
    }
    for (long long i = 0; i < n; i++) {
      cin >> b[i];
      mp2[b[i]] = i;
    }
    for (long long i = 1; i <= n; i++) {
      long long t1 = mp1[i];
      long long t2 = mp2[i];
      long long d = (t2 - t1 + n) % n;
      mp3[d]++;
    }
    long long mx = 0;
    for (auto it : mp3) {
      if (it.second > mx) {
        mx = it.second;
      }
    }
    cout << mx << "\n";
  }
  return 0;
}
