#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, b = 0, c = 0, i, j, k, p;
  scanf("%lld", &n);
  long long a[n + 1];
  memset(a, 0, sizeof(a));
  map<long long, long long> is, hr;
  map<long long, long long>::iterator t, it;
  for (i = 1; i < n + 1; i++) {
    scanf("%lld", &k);
    is[k] = i;
  }
  for (j = 1; j < n + 1; j++) {
    scanf("%lld", &k);
    hr[k] = j;
  }
  for (i = 1; i <= n; i++) {
    it = is.find(i);
    t = hr.find(i);
    if (it->second < t->second) {
      a[n - t->second + it->second]++;
    } else {
      a[it->second - t->second]++;
    }
  }
  sort(a, a + (n + 1));
  cout << a[n] << endl;
  return 0;
}
