#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  map<int, int> m;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]] = i;
  }
  long long int b[n];
  map<int, int> freq;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    int shift = m[b[i]] - i;
    if (m[b[i]] - i < 0) shift = (n - i + m[b[i]]);
    freq[shift]++;
  }
  int ans = 0;
  for (auto i : freq) {
    ans = max(ans, i.second);
  }
  cout << ans << "\n";
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs"
       << "\n";
  return 0;
}
