#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int a[maxn][2];
int K[maxn];
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    int x;
    scanf("%d", &x);
    a[x][0] = i;
  }
  for (int i = 1; i <= N; i++) {
    int x;
    scanf("%d", &x);
    a[x][1] = i;
    int k = (a[x][0] - a[x][1] + N) % N;
    K[k]++;
  }
  int res = 0;
  for (int i = 0; i < N; i++) res = max(res, K[i]);
  printf("%d\n", res);
}
