#include <bits/stdc++.h>
using namespace std;
constexpr int R = 5e5 + 6969, INF = 2e9 + 6969;
int x;
int main() {
  int n, t[2][R], cnt[R];
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    t[0][x] = i;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    t[1][x] = i;
  }
  for (int i = 1; i <= n; ++i) {
    cnt[((t[0][i] - t[1][i] + n) % n + n) % n]++;
  }
  int ans = 1;
  for (int i = 0; i < n; ++i) {
    ans = max(ans, cnt[i]);
  }
  printf("%d\n", ans);
  return 0;
}
