#include <bits/stdc++.h>
using namespace std;
long long a[200005], b[200005], cnt[200005];
int main() {
  long long n, x;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; ++i) {
    scanf("%lld", &x);
    a[x] = i;
  }
  for (long long i = 1; i <= n; ++i) {
    scanf("%lld", &x);
    b[x] = i;
  }
  for (long long i = 1; i <= n; i++) {
    if (a[i] < b[i]) {
      cnt[b[i] - a[i]]++;
    } else {
      cnt[n - a[i] + b[i]]++;
    }
  }
  long long mx = 0;
  for (long long i = 1; i <= n; ++i) {
    mx = max(mx, cnt[i]);
  }
  printf("%lld\n", mx);
  return 0;
}
