#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  int a[n + 1], b[n + 1];
  for (long long int i = 1; i <= n; i += 1) cin >> a[i];
  for (long long int i = 1; i <= n; i += 1) cin >> b[i];
  map<int, int> mp;
  for (long long int i = 1; i <= n; i += 1) mp[b[i]] = i;
  int mx = 0;
  map<int, int> max_left, max_right;
  for (long long int i = 1; i <= n; i += 1) {
    int left = (mp[a[i]] + (n - i)) % n;
    int right = (i + (n - mp[a[i]])) % n;
    max_left[left]++;
    if (max_left[left] > mx) mx = max_left[left];
    max_right[right]++;
    if (max_right[right] > mx) mx = max_right[right];
  }
  cout << mx << endl;
  return 0;
}
