#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n), p(n + 1), q(n + 1), c(n, 0);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    p[a[i]] = i;
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    q[b[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    int diff = p[i] - q[i];
    if (diff < 0) {
      diff += n;
    }
    c[diff]++;
  }
  cout << *max_element(c.begin(), c.end()) << endl;
  return 0;
}
