#include <bits/stdc++.h>
using namespace std;
template <typename T, typename T1>
T maxn(T &a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T minn(T &a, T1 b) {
  if (b < a) a = b;
  return a;
}
void solve() {
  long long int n, ans = 0, anss = 0;
  cin >> n;
  long long int a[n], b[n];
  map<long long int, long long int> ma, mb, mpp, mppp;
  for (long long int(i) = 0; (i) < (n); (i)++) {
    cin >> a[i];
    ma[a[i]] = i + 1;
  }
  for (long long int(i) = 0; (i) < (n); (i)++) {
    cin >> b[i];
    mb[b[i]] = i + 1;
  }
  for (long long int(i) = 1; (i) < (n + 1); (i)++) {
    if (mb[i] > ma[i])
      mpp[n - mb[i] + ma[i]]++;
    else if (mb[i] == ma[i])
      ans++;
    else if (ma[i] > mb[i])
      mpp[ma[i] - mb[i]]++;
  }
  for (auto it : mpp) ans = max(ans, it.second);
  cout << ans << "\n";
}
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int testcase = 1;
  while (testcase--) solve();
  return 0;
}
