#include <bits/stdc++.h>
using namespace std;
int n;
int ans = 0;
int a[200005], b[200005], num2idx[200005], book[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    num2idx[a[i]] = i;
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
    int diff = i - num2idx[b[i]];
    if (diff < 0) diff += n;
    ++book[diff];
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    ans = max(ans, book[i]);
  }
  cout << ans << endl;
  cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n";
  return 0;
}
