#include <bits/stdc++.h>
using namespace std;
int tc, n, a[200001], c;
int ans = 0;
map<int, int> mp;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &c);
    a[c] = i;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &c);
    c = i - a[c];
    c %= n;
    if (c < 0) c += n;
    mp[c]++;
    ans = max(ans, mp[c]);
  }
  printf("%d\n", ans);
  return 0;
}
