#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
void test() {
  long long n, ans = 0;
  cin >> n;
  long long a[n], b[n];
  map<long long, long long> m, m1, m2;
  map<long long, long long>::iterator ir;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]] = i + 1;
  }
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
    m1[b[i]] = i + 1;
  }
  for (long long i = 1; i < n + 1; i++) {
    if (m1[i] >= m[i])
      m2[m1[i] - m[i]]++;
    else
      m2[n + m1[i] - m[i]]++;
  }
  for (ir = m2.begin(); ir != m2.end(); ir++) {
    ans = max(ans, ir->second);
  }
  cout << ans;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long t = 1;
  while (t--) {
    test();
  }
}
