#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n + 1], b[n + 1];
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    a[x] = i;
  }
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    b[x] = i;
  }
  map<long long, long long> m;
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    if (a[i] < b[i]) {
      m[n + a[i] - b[i]]++;
      ans = max(ans, m[n - b[i] + a[i]]);
    } else {
      m[a[i] - b[i]]++;
      ans = max(ans, m[a[i] - b[i]]);
    }
  }
  cout << ans << endl;
}
