#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
const char nl = '\n';
const int inf = 2e9;
const ll INF = (ll)2e18;
const ll mod = 1e9 + 7;
const int N = 2e6 + 15;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, x;
  cin >> n;
  vi a(n), pos(n + 1);
  vi bucket(n, 0);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) {
    cin >> x;
    pos[x] = i;
  }
  for (int i = 0; i < n; ++i) {
    if (pos[a[i]] <= i) {
      bucket[i - pos[a[i]]]++;
    } else {
      bucket[i + n - pos[a[i]]]++;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    ans = max(ans, bucket[i]);
  }
  cout << ans << nl;
  return 0;
}
