#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    map<long long int, long long int> mp, val, count;
    long long int a[n + 1], b[n + 1];
    for (long long int i = 0; i < n; i++) {
      cin >> a[i];
      mp[a[i]] = i;
    }
    for (long long int i = 0; i < n; i++) {
      cin >> b[i];
      val[b[i]] = i;
    }
    long long int mx = 0;
    for (long long int i = 1; i <= n; i++) {
      long long int x = (mp[i] - val[i] + n) % n;
      count[x]++;
      mx = max(mx, count[x]);
    }
    cout << mx << endl;
  }
}
