#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n + 1], b[n + 1];
  int c[n + 1], d[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    c[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    d[b[i]] = i;
  }
  int ans[n + 1];
  for (int i = 1; i <= n; i++) {
    int x = c[i] - d[i];
    if (x < 0) x = n + x;
    ans[i] = x;
  }
  sort(ans + 1, ans + n + 1);
  int q = 0;
  for (int i = 1; i <= n; i++) {
    int x = 1;
    while (ans[i] == ans[i + 1]) {
      x++;
      i++;
    }
    q = max(q, x);
  }
  cout << q;
  return 0;
}
