#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  long long n, x;
  cin >> n;
  vector<int> m(n + 1, 0), v1(n + 1, 0);
  for (int i = 0; i < n; ++i) {
    cin >> x;
    v1[x - 1] = i;
  }
  for (int i = 0; i < n; ++i) {
    cin >> x;
    m[((v1[x - 1] - i) + n) % n]++;
  }
  cout << *max_element(m.begin(), m.end());
  return 0;
}
