#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, x;
  cin >> n;
  vector<long long> f(n), p(n + 1, 0);
  for (long long i = 0; i < n; i++) cin >> x, p[x] = i;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    f[(p[x] - i + n) % n]++;
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) ans = max(ans, f[i]);
  cout << ans;
}
