#include <bits/stdc++.h>
using namespace std;
const int sz = 2e5 + 5;
int a[sz], c[sz];
int main() {
  int n, x, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", &x), a[x] = i;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    int y = a[x] - i;
    if (y < 0) y += n;
    c[y]++;
    ans = max(ans, c[y]);
  }
  cout << ans;
}
