#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int b[n];
  map<int, vector<int>> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    m[x].push_back(i);
  }
  map<int, int> dist;
  int maxi = 0;
  for (int i = 0; i < n; i++) {
    int x = a[i];
    if (m[x].size() != 0) {
      for (int k = 0; k < m[x].size(); k++) {
        int index = m[x][k];
        if (i >= index) {
          dist[i - index]++;
        } else {
          dist[i - index + n]++;
        }
      }
    }
  }
  map<int, int>::iterator it;
  for (it = dist.begin(); it != dist.end(); it++) {
    maxi = max(maxi, it->second);
  }
  cout << maxi;
  return 0;
}
