#include <bits/stdc++.h>
using namespace std;
const int N = 1000000;
int n, a[N], b[N], reva[N], revb[N], bin[N];
void init() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), reva[a[i]] = i;
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]), revb[b[i]] = i;
}
void work() {
  for (int i = 1; i <= n; i++) bin[(reva[i] - revb[i] + n) % n]++;
  int ans = 0;
  for (int i = 0; i < n; i++) ans = max(ans, bin[i]);
  printf("%d\n", ans);
}
int main() {
  init();
  work();
  return 0;
}
