#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long int N = 200005;
long long int n;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  map<long long int, long long int> mp1, mp2, d;
  cin >> n;
  long long int a[n];
  long long int b[n];
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    mp1[a[i]] = i;
  }
  for (long long int i = 0; i < n; i++) {
    cin >> b[i];
    mp2[b[i]] = i;
  }
  for (long long int i = 1; i < n + 1; i++) {
    d[mp1[i] - mp2[i]]++;
    d[mp1[i] - mp2[i] + n]++;
  }
  for (auto i : d) {
    ans = max(ans, i.second);
  }
  cout << ans << "\n";
  return 0;
}
