#include <bits/stdc++.h>
using namespace std;
const int N = 200 * 1001;
int n, a[N], b[N], dis[N], place[N];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    place[b[i]] = i;
  }
  for (int i = 0; i < n; i++) {
    int t = place[a[i]];
    int d = t - i;
    if (d < 0) d += n;
    dis[d]++;
  }
  int maxi = 0;
  for (int i = 0; i < n + 2; i++) maxi = max(maxi, dis[i]);
  cout << maxi << "\n";
}
