#include <bits/stdc++.h>
using namespace std;
int n, i, ans, first;
int a[200005], b[200005], dif[200005];
void solve() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> first;
    a[first] = i;
  }
  for (i = 1; i <= n; i++) {
    cin >> first;
    b[first] = i;
  }
  for (i = 1; i <= n; i++) dif[(a[i] - b[i] + n) % n]++;
  for (i = 0; i <= n; i++) ans = max(ans, dif[i]);
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  srand(time(NULL));
  int t = 1;
  while (t--) solve();
}
