#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> pos1;
  map<int, int> pos2;
  int n;
  cin >> n;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    pos1[a[i]] = i;
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    pos2[b[i]] = i;
  }
  map<int, int> h;
  for (int i = 1; i <= n; i++) {
    if (pos1[i] <= pos2[i]) {
      h[pos2[i] - pos1[i]]++;
    } else {
      h[n - pos1[i] + pos2[i]]++;
    }
  }
  int mx = 0;
  for (int i = 0; i <= 2 * n; i++) {
    if (h[i] > mx) mx = h[i];
  }
  cout << mx;
}
