#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, i, e, f, g, n, m, k, l, t, A[500005], maxx, B[500005];
map<long long, long long> mp, mp1;
int main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> A[i];
    mp1[A[i]] = i;
    A[i] = 0;
  }
  for (long long i = 1; i <= n; i++) {
    cin >> B[i];
    mp[B[i]] = i;
  }
  for (long long i = 1; i <= n; i++) {
    if (mp[i] > mp1[i])
      A[mp[i] - mp1[i]]++;
    else
      A[n - (mp1[i] - mp[i])]++;
  }
  for (long long i = 1; i <= 2 * n; i++) {
    maxx = max(maxx, A[i]);
  }
  cout << maxx << endl;
}
