#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long a[n], b[n];
  for (auto &it : a) cin >> it;
  for (auto &it : b) cin >> it;
  map<long long, long long> m1, m2;
  for (long long i = 0; i < n; i++) {
    m1[a[i]] = i + 1;
  }
  for (long long i = 0; i < n; i++) {
    m2[b[i]] = i + 1;
  }
  map<long long, long long> left, right;
  for (long long i = 1; i <= n; i++) {
    if (m1[i] <= m2[i]) {
      left[m2[i] - m1[i]]++;
    } else {
      left[(n - m1[i]) + m2[i]]++;
    }
    if (m2[i] <= m1[i]) {
      right[m1[i] - m2[i]]++;
    } else {
      right[(n - m2[i]) + m1[i]]++;
    }
  }
  long long ans = 0;
  for (auto &it : left) {
    ans = max(ans, it.second);
  }
  for (auto &it : right) {
    ans = max(ans, it.second);
  }
  cout << ans << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
