#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ar[200000], b[200000];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> ar[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  int ans = 0, ele = 0;
  unordered_map<int, int> mp;
  for (int i = 0; i < n; i++) {
    mp[ar[i]] = i;
  }
  unordered_map<int, int> x;
  for (int j = 0; j < n; j++) {
    if (mp[b[j]] > j)
      x[mp[b[j]] - j]++;
    else
      x[n + mp[b[j]] - j]++;
  }
  for (auto it : x) {
    ans = max(ans, it.second);
  }
  cout << ans << endl;
  return 0;
}
