#include <bits/stdc++.h>
using namespace std;
long long a, b, pos1[200005], pos2[200005], cnt[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, i, j, k, p = 0, q;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a;
    pos1[a] = i;
  }
  for (i = 1; i <= n; i++) {
    cin >> b;
    pos2[b] = i;
  }
  long long ans = 0;
  for (i = 1; i <= n; i++) {
    long long t = pos1[i] - pos2[i];
    if (t <= 0) t += n;
    cnt[t]++;
    ans = max(ans, cnt[t]);
  }
  cout << ans << '\n';
  return 0;
}
