#include <bits/stdc++.h>
using namespace std;
int N;
int df[200001];
int sp[200000] = {0};
int main() {
  int elem;
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> elem, df[elem] = i;
  for (int i = 1; i <= N; i++) {
    cin >> elem;
    int shiftsReq = (df[elem] - i + N) % N;
    sp[shiftsReq] += 1;
  }
  int max = -1;
  for (int i = 0; i < N; i++)
    if (sp[i] > max) max = sp[i];
  cout << max << endl;
}
