#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> A(n + 1);
  map<int, int> mp;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
    mp[A[i]] = i;
  }
  vector<int> B(n + 1);
  int mx = 0;
  vector<int> cnt(n);
  for (int i = 1; i <= n; i++) {
    cin >> B[i];
    A[i] = mp[A[i]];
    B[i] = mp[B[i]];
    cnt[(i - B[i] + n) % n]++;
    mx = max(mx, cnt[(i - B[i] + n) % n]);
  }
  cout << mx;
}
