#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (auto &i : a) cin >> i, i--;
  for (auto &i : b) cin >> i, i--;
  vector<int> rb(n);
  for (int i = 0; i < n; ++i) rb[b[i]] = i;
  vector<int> ans(n);
  for (int i = 0; i < n; ++i) ans[(rb[a[i]] + n - i) % n]++;
  int mx = 0;
  for (auto i : ans) mx = max(mx, i);
  cout << mx << endl;
  return 0;
}
